
import Panel from "../views/Panel";
import PanelCtrl from "../ctrls/panelCtrl";
import { DataManager } from "../../libs/tw/manager/DataManager";
import SceneCtrl from "../ctrls/sceneCtrl";
import { ModuleTypes } from "../types/sceneTypes";
import { Buried } from "../../libs/tw/util/Buried";
import { NetManager } from "../../libs/tw/manager/NetManager";
import Loading from "../loading/Loading";

export default class MsgPanel extends Panel {
    public closeMsgBtn:eui.Button;
    private mData:any;
    public get skinKey() { return 'Msg' }
	public get groupName() { return 'msg_panel'}
    
    constructor(data?:IMsgData){
        super(data);
        this.mData = data;
    }

    onSkinComplete():void{
        super.onSkinComplete();
        this.once(egret.Event.ADDED_TO_STAGE,this.onLoad,this);
		if(this.stage){
			this.onLoad();
        }
        this.showAct();
    }

    start():void{
        this.percentHeight = 100;
    }

    initEvents():void{
        super.initEvents();
        this.closeMsgBtn.addEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ok, this);
    }

    removeEvents():void{
        super.removeEvents();
        this.closeMsgBtn.removeEventListener(egret.TouchEvent.TOUCH_TAP, this.onTap_ok, this);
    }

    private onLoad():void{
     
    }   
    onTap_ok(e:egret.TouchEvent){
        console.log('点击');
        let btnTarget = e.target;
        this.hidePanel();
    }

}

export interface IMsgData{
    btnName:string,
    titleIdx:number,
    msg?:string,
    msg0?:string,
    callBack?:Function,
    closeCallBack?:Function
}