修复stage的宽高错误

This commit is contained in:
YHH
2020-06-19 08:32:35 +08:00
parent 09e6ace142
commit b83b1a5b21
6 changed files with 13 additions and 7 deletions

View File

@@ -1132,7 +1132,7 @@ var Scene = (function (_super) {
Physics.reset();
if (this.entityProcessors)
this.entityProcessors.begin();
this.camera.onSceneSizeChanged(this.stage.width, this.stage.height);
this.camera.onSceneSizeChanged(this.stage.stageWidth, this.stage.stageHeight);
};
Scene.prototype.onActive = function () {
};

File diff suppressed because one or more lines are too long

View File

@@ -105,8 +105,14 @@ class Main extends eui.UILayer {
player.addComponent(new SpawnComponent(EnemyType.worm));
player.addComponent(new PlayerController());
let player2 = scene.createEntity("player2");
player2.addComponent(new BoxCollider()).setSize(99, 99);
for (let i = 0; i < 20; i ++){
let image = new eui.Image(RES.getRes("checkbox_select_disabled_png"));
let player2 = scene.createEntity("player2");
player2.addComponent(new SpriteRenderer()).setSprite(image);
this.addChild(image);
player2.transform.position = new Vector2(Math.random() * 100 * i, Math.random() * 100 * i);
}
scene.camera.setPosition(new Vector2(-200, -200));

View File

@@ -1132,7 +1132,7 @@ var Scene = (function (_super) {
Physics.reset();
if (this.entityProcessors)
this.entityProcessors.begin();
this.camera.onSceneSizeChanged(this.stage.width, this.stage.height);
this.camera.onSceneSizeChanged(this.stage.stageWidth, this.stage.stageHeight);
};
Scene.prototype.onActive = function () {
};

File diff suppressed because one or more lines are too long

View File

@@ -110,7 +110,7 @@ class Scene extends egret.DisplayObjectContainer {
if (this.entityProcessors)
this.entityProcessors.begin();
this.camera.onSceneSizeChanged(this.stage.width, this.stage.height);
this.camera.onSceneSizeChanged(this.stage.stageWidth, this.stage.stageHeight);
}
/** 场景激活 */