
import { _decorator, Component, Node, systemEvent } from 'cc';
import { Util } from '../../module/util';

const { ccclass, property } = _decorator;

@ccclass('Win')
export class Win extends Component {
    // [1]
    // dummy = '';


    start () {
        // [3]
        Util.log('基础窗体构建ok...');
        systemEvent.on("changeWin", this.changeWin, this);
        systemEvent.on("showDialog", this.showDialog, this);
        systemEvent.on("changeMenu", this.changeMenu, this);
        systemEvent.on("showMsg", this.showMsg, this);
        systemEvent.on("showMsgBox", this.showMsgBox, this);
    }
    onDestroy(){
        systemEvent.off("changeWin", this.changeWin, this);
        systemEvent.off("showDialog", this.showDialog, this);
        systemEvent.off("changeMenu", this.changeMenu, this);
        systemEvent.off("showMsg", this.showMsg, this);
        systemEvent.off("showMsgBox", this.showMsgBox, this);
    }

    init(){

    }
    // 切换窗口
    changeWin(name:string,params:object|null = null){

    }
    // 显示dialog窗口
    showDialog(name:string,params:object|null = null){
        
    }
    // 切换菜单
    changeMenu(name:string){

    }
    // 显示提示框
    showMsg(txt:string,timer:number = 0){

    }
    // 显示选择框
    showMsgBox(title:string, txt:string, isShowCannel:boolean=false, callback:Function|null=null){

    }
    // update (deltaTime: number) {
    //     // [4]
    // }
}
