小编Ira*_*ris的帖子

团结 | mesh.colors 不会为我的自定义网格对象着色

我在 Unity 中构建了一个自定义金字塔,如下所示:

    Mesh mesh = GetComponent<MeshFilter>().mesh;
    mesh.Clear();
    Vector3[] vertices = {
        new Vector3(0.0f, 0.5f, 0.0f),
        new Vector3(0.5f, 0.0f, 0.5f),
        new Vector3(-0.5f, 0.0f, 0.5f),
        new Vector3(-0.5f, 0.0f, -0.5f),
        new Vector3(0.5f, 0.0f, -0.5f),
    };

    int[] triangles = {
        1, 2, 3,
        1, 3, 4,
        1, 0, 2,
        2, 0, 3,
        3, 0, 4,
        4, 0, 1
    };


    mesh.vertices = vertices;
    mesh.triangles = triangles;
Run Code Online (Sandbox Code Playgroud)

我正在尝试为我的金字塔着色,正如在这样的统一文档中所说:

    Color[] colors = new Color[vertices.Length];

    for (int i = 0; i < vertices.Length; i++)
        colors[i] = Color.Lerp(Color.red, …
Run Code Online (Sandbox Code Playgroud)

mesh unity-game-engine

4
推荐指数
1
解决办法
3660
查看次数

解析 typescript 文件以获取导出的 const 变量

有没有办法从 .js 文件解析environment.ts 文件?

export const environment = {
    ...,
    production: false,
    ...
}; 
Run Code Online (Sandbox Code Playgroud)

就像是

beforePrepare.js

module.exports = function (ctx) {
    let environmet = TOOL.parse(src/environments/environment.ts);
    console.log(environment); --> PRINT {..., production: false, ...}
}
Run Code Online (Sandbox Code Playgroud)

正则表达式也能完成这项工作吗?

我需要这个来实现科尔多瓦钩子

javascript regex parsing typescript angular

3
推荐指数
1
解决办法
1193
查看次数

Android - ScrollView和PercentRelativeLayout

将android.support.percent.PercentRelativeLayout与ScrollView结合使用时遇到问题.以下xml文件

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fillViewport="true"
android:scrollbars="none">

<android.support.percent.PercentRelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:background="@color/white"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    >
    <ImageView
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        app:layout_widthPercent="50%"
        app:layout_heightPercent="50%"
        app:layout_marginTopPercent="5%"
        app:layout_marginLeftPercent="5%"
        android:src="@drawable/o"
        android:id="@+id/imageView3" />
    <ImageView
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        app:layout_widthPercent="50%"
        app:layout_heightPercent="50%"
        app:layout_marginTopPercent="30%"
        app:layout_marginLeftPercent="5%"
        android:src="@drawable/o"
        android:layout_below="@+id/imageView3"
        android:layout_alignStart="@+id/imageView3"
        android:layout_marginTop="151dp" />
</android.support.percent.PercentRelativeLayout>
Run Code Online (Sandbox Code Playgroud)

打印这个 不是我想要的

使用RelativeLayout它工作正常.有谁知道问题出在哪里?谢谢!

编辑:如果我将ScrollView高度设置为1000dp它也工作正常,但我希望高度像元素一样高

android android-scrollview android-relativelayout android-percentrelativelayout

1
推荐指数
1
解决办法
2340
查看次数

无法绑定到“ng-click”,因为它不是“div”的已知属性

这是我的 ts 组件中的一个简单的 jquery 函数

open_user(user) {
  $(user).css("visibility", "visible");
  $(user).css("opacity", "1");
}
Run Code Online (Sandbox Code Playgroud)

这是我在 html 中的调用方式

<div class="user" *ngFor="let user of arrUsers" ng-click="open_user({{user.id}})">
    <img src={{user.profile_img}} class=user-image>
    ...
</div>
Run Code Online (Sandbox Code Playgroud)

我收到此错误

无法绑定到“ng-click”,因为它不是“div”的已知属性。("

<div class="user" *ngFor="let user of arrUsers" [ERROR ->]ng-click="open_user({{user.id}})">
Run Code Online (Sandbox Code Playgroud)

在任何地方都找不到解决方案..

PS 角度的新手

typescript angularjs-ng-click angular

0
推荐指数
1
解决办法
2139
查看次数

Android 应用程序服务器中的数据库

我正在研究数据库如何在 Android 应用程序中工作,但我很困惑。我有使用 PHP/MySQL 数据库的经验,我在 phpmyadmin 中有一个数据库,我可以通过 php/mysql 查询访问这些数据库。我以为安卓应用程序会是这样,但看来我错了。我也有 MongoDB 和 Java 的经验,但用于本地目的。

我的问题是Android应用程序中的等效方法是什么?

我读过有关 SQLite 的内容,我的理解是它适用于本地用途。我预计我的应用程序中会出现大量数据,因此这对我不起作用。

所以,我需要知道的是如何在服务器上为 Android 应用程序建立一个数据库(如 Web 和 mysql 中的 phpmyadmin)以及如何访问该数据库。

我使用的是 android studio,所以 Java 是编程语言。我可以通过Java与phpmyadmin中的数据库进行通信吗?

任何教程、书籍都非常受欢迎。

提前致谢!

database android

-4
推荐指数
1
解决办法
4036
查看次数