觉醒时刻
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/diaoyu/DiaoYuConfigManage.ts

246 lines
9.4 KiB

import Common5 from "../../Platform/th/Common5";
import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager";
import BagManager from "../Manager/BagManager";
import InterfaceManager from "../Manager/InterfaceManager";
export class DiaoyuYuer {
id: number;
name: string;
unlock: boolean;
price: number;
spTimes: number;
freeTimes: number;
spinSkin: string;
}
export class DiaoyuProbability{
id: number;
name: string;
goodsId: number;
price: number;
yugouProbability: number;
qiuyingProbability: number;
yuerProbability: number;
zhuganProbability: number;
zhulanProbability: number;
luyaProbability: number;
xuyuanchiProbability: number;
}
// let diaoyuConfigs = [
// { buyNum:5, goodId:1301,descStr:'鱼骨', goodName:'鱼骨', priceNum:5},
// { buyNum:5, goodId:1302,descStr:'肉骨头',goodName:'肉骨头', priceNum:5},
// { buyNum:5, goodId:1303,descStr:'泥鳅',goodName:'泥鳅', priceNum:8},
// { buyNum:5, goodId:1304,descStr:'金鱼',goodName:'金鱼', priceNum:10},
// { buyNum:5, goodId:1305,descStr:'鲫鱼',goodName:'鲫鱼', priceNum:20},
// { buyNum:3, goodId:1306,descStr:'旧唱片',goodName:'旧唱片', priceNum:25},
// { buyNum:3, goodId:1307,descStr:'小龙虾',goodName:'小龙虾', priceNum:50},
// { buyNum:2, goodId:1308,descStr:'大鱼雷',goodName:'大鱼雷', priceNum:100},
// { buyNum:2, goodId:1309,descStr:'爬宠蜥蜴',goodName:'爬宠蜥蜴', priceNum:120},
// { buyNum:2, goodId:1310,descStr:'水蜘蛛', goodName:'水蜘蛛', priceNum:180},
// { buyNum:2, goodId:1311,descStr:'帝王蟹', goodName:'帝王蟹', priceNum:300},
// { buyNum:2, goodId:1312,descStr:'大西瓜', goodName:'大西瓜', priceNum:666},
// { buyNum:2, goodId:1313,descStr:'大龙虾', goodName:'大龙虾', priceNum:880},
// { buyNum:3, goodId:1314,descStr:'珍珠', goodName:'珍珠', priceNum:1500},
// { buyNum:3, goodId:1315,descStr:'甲壳虫', goodName:'甲壳虫', priceNum:3000},
// { buyNum:3, goodId:1316,descStr:'98k', goodName:'98k', priceNum:4200},
// { buyNum:1, goodId:1317,descStr:'沉船', goodName:'沉船', priceNum:5000},
// { buyNum:1, goodId:1318,descStr:'息肌丸', goodName:'息肌丸', priceNum:1000},
// { buyNum:1, goodId:1319,descStr:'仓鼠', goodName:'仓鼠', priceNum:1100},
// { buyNum:1, goodId:1320,descStr:'救生衣', goodName:'救生衣', priceNum:1200},
// { buyNum:1, goodId:1321,descStr:'保险箱', goodName:'保险箱', priceNum:1600},
// { buyNum:1, goodId:1322,descStr:'宝藏', goodName:'宝藏', priceNum:2000},
// { buyNum:1, goodId:1323,descStr:'大笨鹅', goodName:'大笨鹅', priceNum:2200},
// { buyNum:1, goodId:1324,descStr:'玉佩', goodName:'玉佩', priceNum:2900},
// { buyNum:1, goodId:1325,descStr:'美酒', goodName:'美酒', priceNum:3200},
// { buyNum:1, goodId:1326,descStr:'大宝剑', goodName:'大宝剑', priceNum:3400},
// { buyNum:1, goodId:1327,descStr:'樱花蛇', goodName:'樱花蛇', priceNum:3800},
// { buyNum:1, goodId:1328,descStr:'玉玺', goodName:'玉玺', priceNum:5000},
// { buyNum:1, goodId:1329,descStr:'金条', goodName:'金条', priceNum:10000},
// ]
let yugouProbability = [10,10,9,8,8,8,8,6,6,6,4,4,4,3,2,2,1,1,0,0,0,0,0,0,0,0,0,0,0]//鱼钩
let qiuyingProbability= [5,5,5,5,5,5,8,8,8,8,8,8,6,2,1,1,1,3,3,3,2,0,0,0,0,0,0,0,0] //蚯蚓
let yuerProbability = [8,8,8,8,7,7,7,7,5,5,5,5,3,3,3,3,2,2,2,2,0,0,0,0,0,0]//鱼饵
let luyaProbability = [0,0,0,0,0,0,0,0,0,4,4,4,5,7,7,7,8,8,8,8,6,6,5,5,4,4]//五连
let zhuganProbability = [1,1,1,4,4,5,5,6,7,7,7,7,5,5,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0]//猪肝
let zhulanProbability = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,15,15,15,15,10,10,10,10]//竹篮子
export default class DiaoYuConfigManage {
public static diaoyuCommonIndex = 0;
public static diaoyuAdIndex = 0;
public static commonIndexFix = 3;
public static adIndexFix = 1;
public static DiaoYuConfigs = null;
static ConfigJsons = [
{id:0, tableName:'DiaoyuYuer', tableFile:'DiaoyuYuer', data:Array<DiaoyuYuer>},
]
public static getCurGoodList(){
// console.log('diaoyuConfig==',this.DiaoYuConfigs)
//将任务/剧情道具替换掉最后的商品
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 == '松花江畔2') && BagManager.getBagGoodNums(goodId) <= 0){
replaceGoodsTab.push(BagManager.getJuQingGoodConfig(goodId))
}
}
let mainTaskInfo:any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
if(mainId == MainTaskIdEnum.MainTask_525){
let goodInfo = BagManager.getJuQingGoodConfig(1711)
replaceGoodsTab.push(goodInfo)
}
let useConfig = []
for(let i=0;i<this.DiaoYuConfigs.length-replaceGoodsTab.length;i++){
useConfig.push(this.DiaoYuConfigs[i])
}
for(let j=0;j<replaceGoodsTab.length;j++){
useConfig.push(replaceGoodsTab[j])
}
// console.log('useConfig==',useConfig)
return useConfig
}
// 该函数在游戏加载的时候调用一次
public static loadAllJson(callFunc){
for(let i = 0; i < DiaoYuConfigManage.ConfigJsons.length; i++){
let tableId = DiaoYuConfigManage.ConfigJsons[i].id;
let tableFile = DiaoYuConfigManage.ConfigJsons[i].tableFile;
cc.loader.loadRes('Json/DiaoyuConfigJson/'+tableFile+'.json', function (err, gameconfig) {
if (err) {
console.log('DiaoyuConfigJson---' + tableFile + '---err:',err);
return;
}
let datas = gameconfig.json
DiaoYuConfigManage.ConfigJsons[tableId].data = datas;
// console.log("钓鱼-鱼饵json加载成功",tableFile)
//修改priceJ价格
});
}
let self = this
cc.loader.loadRes('Json/DiaoyuConfigJson/DiaoyuProbability.json', function (err, gameconfig) {
if (err) {
console.log(err);
return;
}
self.DiaoYuConfigs = gameconfig.json;
callFunc()
// console.log("钓鱼游戏配置加载成功", self.DiaoYuConfigs);
});
}
public static getConfigJson(jsonName):any{
for(let i=0;i<DiaoYuConfigManage.ConfigJsons.length;i++){
if(DiaoYuConfigManage.ConfigJsons[i].tableName == jsonName){
return DiaoYuConfigManage.ConfigJsons[i].data;
}
}
return [];
}
public static getDiaoyuYuerConfig(){
return DiaoYuConfigManage.getConfigJson('DiaoyuYuer')
}
public static getDiaoyuYuerConfigById(id){
let list = DiaoYuConfigManage.getDiaoyuYuerConfig();
for(let i=0;i<list.length;i++){
if(list[i].id == id){
return list[i]
}
}
return null;
}
public static getDiaoyuYuerConfigByName(name){
let list = DiaoYuConfigManage.getDiaoyuYuerConfig();
for(let i=0;i<list.length;i++){
if(list[i].name == name){
return list[i]
}
}
return null;
}
public static getGoodByProbability(name, num,isAD){
console.log(name, num, 'name, num+++++++++++=')
let arr = null
if(name == '鱼钩'){
arr = yugouProbability
}else if(name == '蚯蚓'){
arr = qiuyingProbability
}else if(name == '鱼饵' ){
arr = yuerProbability
}else if(name == '猪肝' ){
arr = zhuganProbability
}else if(name == '竹篮'){
arr = zhulanProbability
}else if(name == '路亚' ){
arr = luyaProbability
}else{
arr = yugouProbability
}
let result = []
if(num==1){
this.diaoyuCommonIndex++
}else if(num==5){
this.diaoyuAdIndex++
}
for(let i=0;i<num;i++){
let index = Common5.getProbabilityResultIndex(arr);
let obj = {
"buyNum": 8,
"goodId": 1301,
"descStr": "鱼骨",
"goodName": "鱼骨",
"priceNum": 5
}
obj.buyNum = this.DiaoYuConfigs[index].buyNum
obj.goodId = this.DiaoYuConfigs[index].goodId
obj.descStr = this.DiaoYuConfigs[index].descStr
obj.goodName = this.DiaoYuConfigs[index].goodName
obj.priceNum = this.DiaoYuConfigs[index].priceNum
result.push(obj);
}
if(this.diaoyuCommonIndex == this.commonIndexFix || this.diaoyuAdIndex == this.adIndexFix){
//修改物品
this.diaoyuCommonIndex = 0
this.diaoyuAdIndex = 0
console.log('获取剧情道具和倒货商人')
//获取剧情道具如果有就不给
//剧情道具有->->
let goodArrayNew = InterfaceManager.changeList('Diaoyu', result ,true,isAD)
return goodArrayNew
}
return result
}
}