Files
esengine/demo/src/UI/mvc/LayerManager.ts

46 lines
1.0 KiB
TypeScript
Raw Normal View History

2020-08-21 19:21:40 +08:00
/**
*
*/
enum viewLayer {
pop,
}
/**
*
*/
class LayerManager {
private static _single: LayerManager;
public static getInstance(): LayerManager{
if (!this._single) this._single = new LayerManager();
return this._single;
}
private _stage: egret.Stage;
/** 弹窗层 */
public popLayer: egret.DisplayObjectContainer;
public tipsLayer: egret.DisplayObjectContainer;
/** 获取舞台 */
public get stage(){
return this._stage;
}
public init(stage: egret.Stage){
this._stage = stage;
this.popLayer = new egret.DisplayObjectContainer();
this.tipsLayer = new egret.DisplayObjectContainer();
this._stage.addChild(this.popLayer);
this._stage.addChild(this.tipsLayer);
}
/**
* layer上
* @param view
*/
public addLayerToView(view: BaseView){
let layerName = viewLayer[view.viewLayer] + "Layer";
this[layerName].addChild(view);
}
}