完善sceneComponent中setEnabled。新增Core.Instance._frameCounter与Core.Instance._totalMemory

This commit is contained in:
yhh
2020-11-30 12:57:53 +08:00
parent 3b4a3fad5a
commit 4c329881a1
8 changed files with 98 additions and 40 deletions

View File

@@ -1,5 +1,5 @@
module es {
export class SceneComponent {
export class SceneComponent implements IComparer<SceneComponent> {
/**
* 这个场景组件被附加到的场景
*/
@@ -60,9 +60,9 @@ module es {
this._enabled = isEnabled;
if (this._enabled){
this.onEnabled();
}else{
this.onDisabled();
}
}
@@ -76,13 +76,13 @@ module es {
public setUpdateOrder(updateOrder: number){
if (this.updateOrder != updateOrder){
this.updateOrder = updateOrder;
Core.scene._sceneComponents.sort(this.compareTo);
Core.scene._sceneComponents.sort(this);
}
return this;
}
public compareTo(other: SceneComponent): number{
public compare(other: SceneComponent): number{
return this.updateOrder - other.updateOrder;
}
}