/** @format */ import {Data, Mgr} from '../GameControl' import {ccUtils} from '../utils/ccUtils' import {UI} from '../enums/UI' import {GAME_TYPE, GOODS} from '../enums/Enum' import {IGameResult, IStageChoose} from '../interface/UIInterface' /** @format */ export class GameManager { async gotoGame() { Data.game.gameBundle = await ccUtils.getBundleAsync('game') Mgr.ui.show(UI.GameLoadingUI) } initNormal() {} initElite() {} async startNormalGame(stageID: number, currentRound: number, currentCost: number) { let isFightStage = stageID == Math.floor(currentRound / 100) Data.game.stageID = stageID Data.game.stageRound = isFightStage ? currentRound : stageID * 100 + 1 //if (CC_DEV) Data.game.cost += 100 Data.game.gameType = GAME_TYPE.normal Data.game.dropOut = null await this.gotoGame() } async startEliteGame(stageID: number) { Data.game.stageID = stageID Data.game.stageRound = Data.game.stageID * 100 + 1 Data.game.gameType = GAME_TYPE.elite Data.game.dropOut = null await this.gotoGame() } exitGame(result?: IGameResult) { Mgr.ui.closeAll() Mgr.ui.show(UI.MainUI) } }