// 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 UIBase from "../../common/ui/base/UIBase"; import { PanelType } from "../../common/ui/config/SysDefine"; import UIBaseEv from "../../common/ui/uiEv/UIBaseEv"; import { MSG_Event } from "../DefineMsg/LogicMsg"; import ProxyClientDataMgr from "../Model/ProxyClientDataMgr"; import ProxyNetDataMgr from "../Model/ProxyNetDataMgr"; import UILobbyLayer from "./UILobbyLayer"; import UIMessageLayer from "./UIMessageLayer"; const {ccclass, property} = cc._decorator; @ccclass export default class UILoadingLayer extends UIBaseEv { panelType: PanelType = PanelType.Screen; @property(cc.ProgressBar) progressBar:cc.ProgressBar = null; // LIFE-CYCLE CALLBACKS: @property(cc.Button) startBtn:cc.Button = null; // onLoad () {} onClickEvent(event,customEventData)//加载完毕显示开始游戏按钮 { switch (+customEventData) { case 0: this.closeStartBtn(); ProxyClientDataMgr.ins().initGameData(); break; default: break; } } initEvent() { this.registEvent(MSG_Event.ReadStartCfg,(x,y)=>{ this.showProgressBar(x,y); });//注册监听事件表现进度条的进度 this.registEvent(MSG_Event.Net_Token,()=>{ ProxyNetDataMgr.ins().getGameData(); }); this.registEvent(MSG_Event.Net_GameData,()=>{ UILobbyLayer.openView(); }); } showProgressBar(x,y) { this.progressBar.progress = x/y; if(x === y) { ProxyNetDataMgr.ins().getGameToken(); } } closeStartBtn()// { this.startBtn.node.active = false; this.progressBar.node.active = true; } start () { //UILobbyLayer.openView(); } // update (dt) {} }