全部移动至es模块

This commit is contained in:
yhh
2020-07-23 11:00:46 +08:00
parent 814234ca61
commit 1b52bc5fd1
71 changed files with 19273 additions and 16907 deletions

View File

@@ -1,46 +1,48 @@
class GlobalManager {
public static globalManagers: GlobalManager[] = [];
private _enabled: boolean;
module es {
export class GlobalManager {
public static globalManagers: GlobalManager[] = [];
private _enabled: boolean;
public get enabled(){
return this._enabled;
}
public set enabled(value: boolean){
this.setEnabled(value);
}
public setEnabled(isEnabled: boolean){
if (this._enabled != isEnabled){
this._enabled = isEnabled;
if (this._enabled){
this.onEnabled();
} else {
this.onDisabled();
public get enabled(){
return this._enabled;
}
public set enabled(value: boolean){
this.setEnabled(value);
}
public setEnabled(isEnabled: boolean){
if (this._enabled != isEnabled){
this._enabled = isEnabled;
if (this._enabled){
this.onEnabled();
} else {
this.onDisabled();
}
}
}
}
public onEnabled(){}
public onEnabled(){}
public onDisabled(){}
public onDisabled(){}
public update(){}
public update(){}
public static registerGlobalManager(manager: GlobalManager){
this.globalManagers.push(manager);
manager.enabled = true;
}
public static unregisterGlobalManager(manager: GlobalManager){
this.globalManagers.remove(manager);
manager.enabled = false;
}
public static getGlobalManager<T extends GlobalManager>(type){
for (let i = 0; i < this.globalManagers.length; i ++){
if (this.globalManagers[i] instanceof type)
return this.globalManagers[i] as T;
public static registerGlobalManager(manager: GlobalManager){
this.globalManagers.push(manager);
manager.enabled = true;
}
return null;
public static unregisterGlobalManager(manager: GlobalManager){
this.globalManagers.remove(manager);
manager.enabled = false;
}
public static getGlobalManager<T extends GlobalManager>(type){
for (let i = 0; i < this.globalManagers.length; i ++){
if (this.globalManagers[i] instanceof type)
return this.globalManagers[i] as T;
}
return null;
}
}
}
}