marineparkclient/assets/script/StartCtr.ts
2023-08-15 11:09:12 +08:00

60 lines
1.4 KiB
TypeScript

// Learn TypeScript:
// - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
import UIBaseEv from "../common/ui/uiEv/UIBaseEv";
import { MSG_Event } from "./DefineMsg/LogicMsg";
import MainFacade from "./MainFacade";
import UILoadingLayer from "./ui/UILoadingLayer";
import UIMessageLayer from "./ui/UIMessageLayer";
import UITwisterLayer from "./ui/UITwisterLayer";
const {ccclass, property} = cc._decorator;
@ccclass
export default class StartCtr extends UIBaseEv {
// LIFE-CYCLE CALLBACKS:
onLoad () {
MainFacade.init(this.node);
this.initEvent();
}
initEvent()
{
this.registEvent(MSG_Event.Net_LoadingBegin,this.openLoadingPanel);
this.registEvent(MSG_Event.Net_LoadingEnd,this.openLoadingPanel);
this.registEvent(MSG_Event.Net_ERRO,(x)=>{
this.openMessagePanel(x);
})
}
openMessagePanel(messageStr:string)
{
UIMessageLayer.openView(messageStr);
}
openLoadingPanel()
{
UITwisterLayer.openView();
}
closeLoadingPanel()
{
UITwisterLayer.closeView();
}
start () {
UILoadingLayer.openView();
}
// update (dt) {}
}