觉醒时刻
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
juexingshike/assets/Scripts/Manager/KuaidiManager.ts

89 lines
4.1 KiB

1 week ago
// Learn TypeScript:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
// Learn Attribute:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
// - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
//快递
// let kuaidiConfigs = [
// { buyNum:3, goodId:1001,descStr:'萝卜刀', goodName:'萝卜刀', priceNum:2},
// { buyNum:3, goodId:1002,descStr:'大奖彩票',goodName:'大奖彩票', priceNum:5},
// { buyNum:3, goodId:1003,descStr:'葵花宝典',goodName:'葵花宝典', priceNum:10},
// { buyNum:3, goodId:1004,descStr:'火球',goodName:'火球', priceNum:10},
// { buyNum:3, goodId:1005,descStr:'金球',goodName:'金球', priceNum:10},
// { buyNum:3, goodId:1006,descStr:'痔疮膏',goodName:'痔疮膏', priceNum:12},
// { buyNum:3, goodId:1007,descStr:'拉菲草礼盒',goodName:'拉菲草礼盒', priceNum:20},
// { buyNum:3, goodId:1008,descStr:'厘子耳机',goodName:'厘子耳机', priceNum:20},
// { buyNum:3, goodId:1009,descStr:'青稞面',goodName:'青稞面', priceNum:23},
// { buyNum:3, goodId:1010,descStr:'肌肉猛男', goodName:'肌肉猛男', priceNum:30},
// { buyNum:3, goodId:1011,descStr:'跑车', goodName:'跑车', priceNum:30},
// { buyNum:3, goodId:1012,descStr:'腰带', goodName:'腰带', priceNum:60},
// { buyNum:3, goodId:1013,descStr:'宠物蜘蛛', goodName:'宠物蜘蛛', priceNum:200},
// { buyNum:3, goodId:1014,descStr:'老人机', goodName:'老人机', priceNum:200},
// { buyNum:3, goodId:1015,descStr:'大保健', goodName:'大保健', priceNum:330},
// { buyNum:3, goodId:1016,descStr:'金豆子', goodName:'金豆子', priceNum:570},
// { buyNum:3, goodId:1017,descStr:'切尔西', goodName:'切尔西', priceNum:666},
// { buyNum:3, goodId:1018,descStr:'打狗棍', goodName:'打狗棍', priceNum:888},
// { buyNum:3, goodId:1019,descStr:'世纪名画', goodName:'世纪名画', priceNum:1000},
// { buyNum:3, goodId:1020,descStr:'滑板车', goodName:'滑板车', priceNum:1200},
// { buyNum:2, goodId:1021,descStr:'翡翠烟锅', goodName:'翡翠烟锅', priceNum:3000},
// { buyNum:2, goodId:1022,descStr:'金斧头', goodName:'金斧头', priceNum:3200},
// { buyNum:1, goodId:1023,descStr:'徽墨', goodName:'徽墨', priceNum:6000},
// ]
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import BagManager from "./BagManager";
import InterfaceManager from "./InterfaceManager";
export default class KuaidiManager{
static gameConfigs = [];
public static getManagerConfigs(){
return this.gameConfigs
}
public static initManager(callFunc){
let self = this
cc.loader.loadRes('Json/gameConfig/kuaidi.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 == '快递站' || daoYeList[i].gameType == '顾氏快递') && BagManager.getBagGoodNums(goodId) <= 0){
replaceGoodsTab.push(BagManager.getJuQingGoodConfig(goodId))
}
}
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_554){
let goodInfo = BagManager.getJuQingGoodConfig(2707)
replaceGoodsTab.push(goodInfo)
}
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])
}
return useConfig
}
}