import User from "../../FrameWork/User/User"; import Common5 from "../../Platform/th/Common5"; import TaskManager, { MainTaskIdEnum } from "../JuQingChat/TaskManager"; import BagManager from "../Manager/BagManager"; const { ccclass, property } = cc._decorator; export enum HookClawState { START = 'start', LAUNCH = 'launch', RECOVERY = 'recovery' } const HuangJinYuFuConfig = { //普通鱼 80% commonFishType: [ { goodId: 4001, id: 100, name: '龙虾', url: 'prefab/龙虾', skin: '口味虾', moveType: 1, moveSpeed: 150, catchPbl: 1, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4002, id: 101, name: '小丑鱼', url: 'prefab/小丑鱼', skin: '尼莫', moveType: 1, moveSpeed: 150, catchPbl: 1, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4003, id: 102, name: '螃蟹', url: 'prefab/螃蟹', skin: '庞海', moveType: 1, moveSpeed: 150, catchPbl: 1, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4004, id: 103, name: '蚌壳', url: 'prefab/蚌壳', skin: '贝壳', moveType: 0, moveSpeed: 0, catchPbl: 0.95, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4005, id: 104, name: '海星', url: 'prefab/海星', skin: '还行', moveType: 0, moveSpeed: 0, catchPbl: 0.95, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4006, id: 105, name: '鳖', url: 'prefab/鳖', skin: '王八', moveType: 1, moveSpeed: 150, catchPbl: 0.9, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4007, id: 106, name: '海胆', url: 'prefab/海胆', skin: '海胆', moveType: 0, moveSpeed: 0, catchPbl: 0.95, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4008, id: 107, name: '海鱼1', url: 'prefab/海鱼1', skin: '海鱼1', moveType: 1, moveSpeed: 200, catchPbl: 0.95, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4009, id: 108, name: '海鱼2', url: 'prefab/海鱼2', skin: '海鱼2', moveType: 1, moveSpeed: 200, catchPbl: 0.75, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 }, { goodId: 4010, id: 109, name: '海鱼3', url: 'prefab/海鱼3', skin: '海鱼3', moveType: 1, moveSpeed: 200, catchPbl: 0.7, recoverySpeed: 0.7, appearPbl: 0.1, income: 10000 } ], //特殊鱼 20% specialFishType: [ { goodId: 4011, id: 200, name: '电鳗', url: 'prefab/电鳗', skin: '吴亦凡', moveType: 1, moveSpeed: 150, catchPbl: 0.5, appearPbl: 0.2, recoverySpeed: 0.5, income: 100000 }, { goodId: 4012, id: 201, name: '章鱼', url: 'prefab/章鱼', skin: '克苏鲁', moveType: 2, moveSpeed: 150, catchPbl: 0.6, appearPbl: 0.2, recoverySpeed: 0.5, income: 100000 }, { goodId: 4013, id: 202, name: '海鱼4', url: 'prefab/海鱼4', skin: '海鱼4', moveType: 1, moveSpeed: 200, catchPbl: 0.5, appearPbl: 0.2, recoverySpeed: 0.5, income: 100000 }, { goodId: 4014, id: 203, name: '海鱼5', url: 'prefab/海鱼5', skin: '旗鱼', moveType: 1, moveSpeed: 300, catchPbl: 0.3, appearPbl: 0.15, recoverySpeed: 0.5, income: 100000 }, { goodId: 4015, id: 204, name: '道具一', url: 'prefab/道具一', skin: '道具', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0.1, recoverySpeed: 0.5, income: 100000 }, { goodId: 4016, id: 205, name: '道具二', url: 'prefab/道具二', skin: '道具', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0.15, recoverySpeed: 0.5, income: 100000 }, { goodId: 4017, id: 206, name: '等级1', url: 'prefab/等级1', skin: '等级2', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0, recoverySpeed: 0.5, income: 2 }, { goodId: 4018, id: 207, name: '等级2', url: 'prefab/等级2', skin: '等级3', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0, recoverySpeed: 0.5, income: 3 }, { goodId: 4019, id: 208, name: '等级3', url: 'prefab/等级3', skin: '等级5', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0, recoverySpeed: 0.5, income: 5 }, { goodId: 1704, id: 214, name: '驱魔珠', url: 'prefab/驱魔珠', skin: '驱魔珠', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0, recoverySpeed: 0.5, income: 0 }, { goodId: 1705, id: 215, name: '定心石', url: 'prefab/定心石', skin: '定心石', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0, recoverySpeed: 0.5, income: 0 }, { goodId: 1706, id: 216, name: '麒麟晶', url: 'prefab/麒麟晶', skin: '麒麟晶', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0, recoverySpeed: 0.5, income: 0 }, { goodId: 1707, id: 217, name: '辟邪玉', url: 'prefab/辟邪玉', skin: '辟邪玉', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0, recoverySpeed: 0.5, income: 0 }, { goodId: 1708, id: 218, name: '灵魂锁', url: 'prefab/灵魂锁', skin: '灵魂锁', moveType: 0, moveSpeed: 0, catchPbl: 1, appearPbl: 0, recoverySpeed: 0.5, income: 0 }, ], //广告道具 specialPropType: [ ] } class HuangJinYuFuManager { public MaxFishNum: number = 15; //最大鱼数量 public SpecialPbl: number = 20; //特殊鱼概率 public fishDataList: any[] = []; //鱼数据列表 //获取鱼信息 public getFishInfoById(id: number) { for (const key in HuangJinYuFuConfig) { if (Object.prototype.hasOwnProperty.call(HuangJinYuFuConfig, key)) { const element = HuangJinYuFuConfig[key]; for (const iterator of element) { if (iterator.id == id) { return iterator; } } } } } //获取鱼信息 public getFishInfoList() { let fishInfoList = []; for (const key in HuangJinYuFuConfig) { if (Object.prototype.hasOwnProperty.call(HuangJinYuFuConfig, key)) { const element = HuangJinYuFuConfig[key]; for (const iterator of element) { fishInfoList.push(iterator); } } } return fishInfoList; } //获取鱼数据 public getFishDataList(fishSizeMap: Map, fishRange: cc.Size) { // return this.randomFishList(fishSizeMap, fishRange); // //测试 fix me this.fishDataList = User.getSaveFishDataList(); if (this.getFishDataListLength() <= 0) { this.fishDataList = this.randomFishList(fishSizeMap, fishRange); console.log('生成新的鱼数据!'); //保存鱼数据 let gentQuat = User.getGenerateFishQuantity() - 1; User.setFishDataAndGentQuat(this.fishDataList, gentQuat); return this.fishDataList; } else { console.log('获取旧鱼数据!'); return this.fishDataList; } } //随机生成鱼数据 public randomFishList(fishSizeMap: Map, fishRange: cc.Size) { //随机生成鱼坐标 const randomNodePos = (fishData) => { fishData.pos.x = fishData.rect.x = Common5.getRandomNum(-fishRange.width / 2, fishRange.width / 2); fishData.pos.y = fishData.rect.y = Common5.getRandomNum(-fishRange.height / 2, fishRange.height / 2); for (const iterator of this.fishDataList) { if (iterator.rect.intersects(fishData.rect)) { randomNodePos(fishData); } } } //随机生成鱼数据 this.fishDataList= []; for (let index = 0; index < this.MaxFishNum; index++) { let fishTypeConfig = HuangJinYuFuConfig.commonFishType; if (Common5.getRandomNum(0, 100) < this.SpecialPbl) { fishTypeConfig = HuangJinYuFuConfig.specialFishType; } let random = Math.random(); for (const iterator of fishTypeConfig) { random -= iterator.appearPbl; if (random < 0) { let fishSize = fishSizeMap.get(iterator.name); let fishData = { id: iterator.id, rect: new cc.Rect(0, 0, fishSize.width, fishSize.height), pos: cc.v2(0, 0), }; randomNodePos(fishData); console.log('鱼名:' + iterator.name); this.fishDataList.push(fishData); break; } } } let dengjiArray = [206,207,208] let addIndex2 =0 for(let i = this.fishDataList.length-1; i>=4;i--){ this.fishDataList[i].id = dengjiArray[addIndex2] addIndex2++ if(addIndex2 == dengjiArray.length){ break } } //任务需要 修改鱼ID fix me let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo() let mainId = mainTaskInfo.Id if(mainId == MainTaskIdEnum.MainTask_516) { let fishArray = [1704,1705,1706,1707,1708] let configIdArray = [214,215,216,217,218] let randIndex = 1 // 出两个 // if(BagManager.isHaveAllGood([10066,10067,10068,10069])){ // randIndex = 1// 出1个 // } let addIndex =0 for(let i = 0;i