import Panel from "./Panel";
import SceneCtrl from "../ctrls/sceneCtrl";
import { ModuleTypes } from "../types/sceneTypes";
export default class Alert extends Panel {
    public body:eui.Group;
    public closeBtn:eui.Button;
    public closeBtn2:eui.Button;
    

    start(data) {
        const { message, btnTxt } = data;
        this.data.message = message;
        this.data.btnTxt = btnTxt || '确定';
       /*  this.body.horizontalCenter = 0;
        this.body.verticalCenter = 0; */
        this.body.y=this.stage.stageHeight/2- this.body.height/2
        this.stage
    }

    initEvents(){
        super.initEvents();
       
        this.closeBtn2.once(egret.TouchEvent.TOUCH_TAP, this.onTouchTap_closeBtn, this);

        console.log(egret)
       // console.log(this.body.stage)
       // this.body.y=this.body.stage.stageHeight/2- this.body.height/2
        
    }


    onTouchTap_closeBtn(){
        if( localStorage.gameState=="gameSubmit"|| localStorage.gameState=="getSubmitResult"){
            SceneCtrl.instance.change(ModuleTypes.START_SCENE);
        }
        super.onTouchTap_closeBtn()
    }
    

     get skinKey() { return 'Alert' }

    protected get closeBtns(): eui.Button[] {
        return [this['closeBtn']]
    }
}