我正在按照以下教程设置:https://www.youtube.com/watch?v = owBt9SNKXCI&index = 6&list = PLbghT7MmckI4qGA0Wm_TZS8LVrqS47I9R来动态构建切片贴图布局.它适用于某一点,但它产生了一个非常奇怪的布局,128 x 128大小的瓷砖.
很明显,不应该发生奇怪的分区,但我似乎无法追查导致它的原因.这是我的代码版本,它与quill18creates的版本大致相同,只有一些小差异:
using UnityEngine;
using System.Collections;
[ExecuteInEditMode]
public class TileMap : MonoBehaviour {
public int size_x = 100;
public int size_z = 50;
public float tileSize = 1.0f;
public Texture2D terrainTiles;
int tileResolution = 128;
// Use this for initialization
void Start () {
BuildMesh();
}
Color[][] ChopUpTiles() {
int numTilesPerRow = terrainTiles.width / tileResolution;
int numRows = terrainTiles.height / tileResolution;
Color[][] tiles = new Color[numTilesPerRow*numRows][];
for(int y=0; …Run Code Online (Sandbox Code Playgroud) 我一直在尝试研究 Nginx 以在 localhost:4200 上配置具有 Angular 5 ng 服务的代理,但是只得出为已构建的项目提供服务的结果。我从这项研究中发现的配置“有点”有效,但会产生一个未加载任何数据的白页:
dev:12 GET http://192.168.1.84/inline.bundle.js net::ERR_ABORTED
dev:12 GET http://192.168.1.84/polyfills.bundle.js net::ERR_ABORTED
dev:12 GET http://192.168.1.84/styles.bundle.js net::ERR_ABORTED
dev:12 GET http://192.168.1.84/vendor.bundle.js net::ERR_ABORTED
dev:12 GET http://192.168.1.84/main.bundle.js net::ERR_ABORTED
Run Code Online (Sandbox Code Playgroud)
看起来它看不到 ng serve 提供的文件,但至少到达了项目的 index.html 页面。这是我目前使用的配置:
location /dev {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
rewrite ^/(.*)$ /$1 break;
proxy_set_header Host localhost;
proxy_pass http://localhost:4200;
}
Run Code Online (Sandbox Code Playgroud)
我应该在 /dev 配置中添加什么?
我正在尝试为小型 API 运行服务器构建。然而,我遇到了一个痛苦的问题。Mongoose 无法在 TypeScript 下编译,因为它是 MongoDB 的内部构建。这个问题是类似的,但不是其他问题的精确重复 - 我找到了其中的一些,但他们的解决方案不起作用。
这是我得到的输出,有错误:
> servapi@1.0.0 clean
> node node_modules/rimraf/bin lib
node_modules/mongodb/mongodb.d.ts:3571:117 - error TS1005: '?' expected.
3571 export declare type Join<T extends unknown[], D extends string> = T extends [] ? '' : T extends [string | number] ? `${T[0]}` : T extends [string | number, ...infer R] ? `${T[0]}${D}${Join<R, D>}` : string;
node_modules/mongodb/mongodb.d.ts:3571:127 - error TS1005: ';' expected.
3571 export declare type Join<T extends unknown[], D extends string> = T extends …Run Code Online (Sandbox Code Playgroud) 我正在使用Pixi.js作为渲染引擎,在Javascript中开展一个小项目.但是,我只发现了一些将画布缩放到完整窗口的方法,这些方法似乎最适合当前版本.但是,它有一个警告,因为它根据方向在侧面产生信箱.
是否可以通过Pixi避免使用信箱?
这是我到目前为止的代码,因为它与缩放有关:
var application = null;
var GAME_WIDTH = 1060;
var GAME_HEIGHT = 840;
var ratio = 0;
var stage = null;
application = new PIXI.Application(
{
width: GAME_WIDTH,
height: GAME_HEIGHT,
backgroundColor: 0x00b4f7,
view: document.getElementById("gwin")
});
stage = new PIXI.Container(true);
window.addEventListener("resize", rescaleClient);
function rescaleClient()
{
ratio = Math.min(window.innerWidth / GAME_WIDTH, window.innerHeight /
GAME_HEIGHT);
stage.scale.x = stage.scale.y = ratio;
application.renderer.resize(Math.ceil(GAME_WIDTH * ratio), Math.ceil(GAME_HEIGHT * ratio));
}
Run Code Online (Sandbox Code Playgroud)
我的目标是实现与Agar.io/Slither.io类似的全屏/窗口效果,但是我还没有找到一种方便的方法.似乎有一些使用Pixi来实现这一目标的例子,但代码通常是封闭源代码,并且它们似乎使用外部工具,如Ionic和Phonegap.
我想立即声明我不经常使用着色器,而我正在使用的基本着色器 - 来自 Unity 论坛中的一个线程的力场着色器,是一个更旧的版本。然而,原来的“几乎”做了我想要的。
我想修改它以添加滚动效果以模拟速度,但奇怪的是我得到了“无法识别的标识符‘输入’”。IN Input 是一个普通变量.. 据说,在 Unity 的着色器中。到目前为止,这是我的代码:
Shader "Custom/SubspaceLook" {
Properties {
_Color ("Main Color", Color) = (1,1,1,0.5)
_MainTex ("Texture", 2D) = "white" {}
_UVScale ("UV Scale", Range (0.05, 4)) = 1
_UVDistortion ("UV Distortion", Range (0.01, 1)) = 0.5
_Rate ("Oscillation Rate", Range (5, 200)) = 10
_Rate2 ("Oscillation Rate Difference", Range (1, 3)) = 1.43
_ZPhase ("Z Phase", Range (0, 3)) = 0.5
_Scale ("Scale", Range (0.02, 2)) = 0.5
_Distortion ("Distortion", Range (0, …Run Code Online (Sandbox Code Playgroud) angular ×1
c# ×1
canvas ×1
javascript ×1
mongodb ×1
mongoose ×1
nginx ×1
node.js ×1
pixi.js ×1
shader ×1
typescript ×1
uv-mapping ×1