squidGame/tgx-games-client/assets/module_arean/ui_battle_loading/UIBattleLoading.ts

47 lines
1.9 KiB
TypeScript
Raw Normal View History

2025-02-07 10:49:34 +08:00
/************************************************************************************
* FileName : UIBattleLoading.ts
* Description :
* Version : v1.0.0
* CreateTime : 2024-11-26 08:43:00
* Author :
* Copyright (c) 2024
* ==============================================================
* Method Description:
*
* ==============================================================
************************************************************************************/
import {GameUILayers} from "db://assets/scripts/GameUILayers";
import {tgx_class} from "db://assets/core_tgx/base/ModuleContext";
import {ModuleDef} from "db://assets/scripts/ModuleDef";
import {tgxUIAlert, tgxUIController} from "db://assets/core_tgx/tgx";
import {Layout_UIBattleLoading} from "db://assets/module_arean/ui_battle_loading/Layout_UIBattleLoading";
import {AreanNetMgr} from "db://assets/module_arean/scripts/AreanNetMgr";
@tgx_class(ModuleDef.Arean)
export class UIBattleLoading extends tgxUIController{
constructor() {
super("ui_battle_loading/BattleLoading", GameUILayers.POPUP,Layout_UIBattleLoading)
}
protected onCreated(params: any) {
let layout = this.layout as Layout_UIBattleLoading;
let getRandom = (min:number, max:number)=>{
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min)) + min;
}
let random = getRandom(1,3);
layout.bg_1.active = false;
layout.bg_2.active = false;
layout.bg_3.active = false;
layout["bg_" + random].active = true;
// let timer = setTimeout(async () => {
// clearTimeout(timer);
// let res = await AreanNetMgr.inst.sendMsg_StartGame();
// if (!res.res.isStarted) {
// tgxUIAlert.show("开始游戏失败,有玩家没准备");
// }
// this.close();
// },5000)
}
}