import BagManager from "../../Manager/BagManager"; import InterfaceManager from "../../Manager/InterfaceManager"; export enum Manghe { Manghe1, Manghe2, Manghe3, } export default class KuaiDiZhanManager { static gameConfigs = []; public static MangheSpine = [ { type: Manghe.Manghe1, spine: "抓娃娃", Animation: "1" }, { type: Manghe.Manghe2, spine: "抓娃娃", Animation: "2" }, { type: Manghe.Manghe2, spine: "抓娃娃", Animation: "3" }, ] public static getAnimation() { function getRandom(X: number, Y: number) { X = Math.ceil(X) Y = Math.floor(Y); return Math.floor(Math.random() * (Y - X + 1)) - X; } let temp = getRandom(0, 2) return temp; } public static getManagerConfigs() { return this.gameConfigs } public static initManager(callFunc) { let self = this cc.loader.loadRes('Json/gameConfig/kuaiDiZhan.json', function (err, gameconfig) { if (err) { console.log(err); return; } self.gameConfigs = gameconfig.json; // console.log("游戏配置加载成功", self.gameConfigs); callFunc() }); } public static getCurGoodList() { //将任务/剧情道具替换掉最后的商品 let daoYeList = InterfaceManager.getDaoyeList() let replaceGoodsTab = [] for (let i = 0; i < daoYeList.length; i++) { let goodId = daoYeList[i].goodId if (daoYeList[i].gameType == 'KuaiDiZhan' && BagManager.getBagGoodNums(goodId) <= 0) { replaceGoodsTab.push(BagManager.getJuQingGoodConfig(goodId)) } } // let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo() // let mainId = mainTaskInfo.Id // if(mainId == MainTaskIdEnum.MainTask_555){ // let goodInfo2701 = BagManager.getJuQingGoodConfig(2701) // let goodInfo2702 = BagManager.getJuQingGoodConfig(2702) // let goodInfo2703 = BagManager.getJuQingGoodConfig(2703) // replaceGoodsTab.push(goodInfo2701) // replaceGoodsTab.push(goodInfo2702) // replaceGoodsTab.push(goodInfo2703) // } let useConfig = [] for (let i = 0; i < this.gameConfigs.length - replaceGoodsTab.length; i++) { useConfig.push(this.gameConfigs[i]) } for (let j = 0; j < replaceGoodsTab.length; j++) { useConfig.push(replaceGoodsTab[j]) } console.log('快递站GoodList==', useConfig) return useConfig } }