新增scene.optimizeCost参数 用于优化cost过高情况

This commit is contained in:
yhh
2020-09-16 14:48:15 +08:00
parent 8e97dcda9c
commit 52980f0b55
9 changed files with 90 additions and 21 deletions

View File

@@ -90,6 +90,7 @@ module es {
this.displayObject.anchorOffsetY = this._origin.y;
}
this.displayObject = new Bitmap(sprite.texture2D);
this.displayObject.touchEnabled = false;
return this;
}
@@ -99,7 +100,7 @@ module es {
* @param origin
*/
public setOrigin(origin: Vector2): SpriteRenderer {
if (this._origin != origin) {
if (!this._origin.equals(origin)) {
this._origin = origin;
this.displayObject.anchorOffsetX = this._origin.x;
this.displayObject.anchorOffsetY = this._origin.y;
@@ -123,8 +124,8 @@ module es {
public render(camera: Camera) {
this.sync(camera);
if (this.displayObject.x != this.bounds.x - camera.bounds.x) this.displayObject.x = this.bounds.x - camera.bounds.x;
if (this.displayObject.y != this.bounds.y - camera.bounds.y) this.displayObject.y = this.bounds.y - camera.bounds.y;
if (this.displayObject.x != this.bounds.x - camera.bounds.x + this._origin.x) this.displayObject.x = this.bounds.x - camera.bounds.x + this._origin.x;
if (this.displayObject.y != this.bounds.y - camera.bounds.y + this._origin.y) this.displayObject.y = this.bounds.y - camera.bounds.y + this._origin.y;
}
}
}