新增IUpdatable接口 用于减少update所带来的的性能损耗

This commit is contained in:
yhh
2020-07-10 11:24:42 +08:00
parent 877fc4c9bf
commit f6c2d81a83
14 changed files with 238 additions and 79 deletions

View File

@@ -4,6 +4,7 @@ abstract class Component extends egret.DisplayObjectContainer {
public updateInterval: number = 1;
/** 允许用户为实体存入信息 */
public userData: any;
private _updateOrder = 0;
public get enabled(){
return this.entity ? this.entity.enabled && this._enabled : this._enabled;
@@ -31,6 +32,22 @@ abstract class Component extends egret.DisplayObjectContainer {
return this;
}
/** 更新此实体上组件的顺序 */
public get updateOrder(){
return this._updateOrder;
}
/** 更新此实体上组件的顺序 */
public set updateOrder(value: number){
this.setUpdateOrder(value);
}
public setUpdateOrder(updateOrder: number){
if (this._updateOrder != updateOrder){
this._updateOrder = updateOrder;
}
return this;
}
public initialize(){
}
@@ -50,10 +67,6 @@ abstract class Component extends egret.DisplayObjectContainer {
}
public update(){
}
public debugRender(){
}