// 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 import { ryw_Event } from "../../FrameWork/Event/EventEnum" import EventMgr from "../../FrameWork/Event/EventMgr" import User from "../../FrameWork/User/User" import Common5 from "../../Platform/th/Common5" import MiShuManager from "./MiShuManager" import ShipuManager from "./ShipuManager" import TanWeiManager from "./TanWeiManager" let chenghaoConfig = [ { id: 0, level: 1, chenghaoStr: '乡里包子铺', inComeMultiple: 0 }, { id: 1, level: 50, chenghaoStr: '镇上包子铺', inComeMultiple: 2.0 }, { id: 2, level: 100, chenghaoStr: '县城包子铺', inComeMultiple: 3.0 }, { id: 3, level: 150, chenghaoStr: '市区包子铺', inComeMultiple: 5.0 }, { id: 4, level: 200, chenghaoStr: '首都包子铺', inComeMultiple: 20.0 }, { id: 5, level: 250, chenghaoStr: '一星店铺', inComeMultiple: 30.0 }, { id: 6, level: 300, chenghaoStr: '二星店铺', inComeMultiple: 200.0 }, { id: 7, level: 350, chenghaoStr: '三星店铺', inComeMultiple: 900.0 }, { id: 8, level: 400, chenghaoStr: '四星店铺', inComeMultiple: 900.0 }, { id: 9, level: 450, chenghaoStr: '五星店铺', inComeMultiple: 900.0 }, { id: 10, level: 500, chenghaoStr: '一年老店', inComeMultiple: 900.0 }, { id: 11, level: 550, chenghaoStr: '十年老店', inComeMultiple: 900.0 }, { id: 12, level: 600, chenghaoStr: '百年老店', inComeMultiple: 900.0 }, { id: 13, level: 650, chenghaoStr: '千年老店', inComeMultiple: 900.0 }, { id: 14, level: 700, chenghaoStr: '万年老店', inComeMultiple: 900.0 }, { id: 15, level: 800, chenghaoStr: '名师早餐店', inComeMultiple: 900.0 }, { id: 16, level: 900, chenghaoStr: '宗师早餐店', inComeMultiple: 900.0 }, { id: 17, level: 1000, chenghaoStr: '泰斗早餐店', inComeMultiple: 900.0 }, { id: 18, level: 1100, chenghaoStr: '传奇早餐店', inComeMultiple: 900.0 }, { id: 19, level: 1200, chenghaoStr: '宇宙早餐店', inComeMultiple: 900.0 }, ] let jiesuoProConfig = [ // {level:10, pro:[{isPic:false, name:'云欣'}]}, // {level:50, pro:[{isPic:false, name:'媱安'}]}, // {level:100, pro:[{isPic:false, name:'诗涵' }, {isPic:true, name:'调味盒', isShipu:false}]}, // {level:200, pro:[{isPic:false, name:'婉仪' }, {isPic:true, name:'小炒时蔬', isShipu:true}]}, // {level:300, pro:[{isPic:false, name:'诺依' }, {isPic:true, name:'西红柿炒鸡蛋', isShipu:true}]}, // {level:350, pro:[{isPic:true, name:'酱油', isShipu:false}]}, // {level:400, pro:[{isPic:false, name:'班的多' }, {isPic:true, name:'辣椒炒肉', isShipu:true}]}, // {level:450, pro:[{isPic:true, name:'抹布', isShipu:false }]}, // {level:500, pro:[{isPic:false, name:'蕾蕾' }, {isPic:true, name:'鱼香肉丝', isShipu:true}]}, // {level:550, pro:[ {isPic:true, name:'海报' , isShipu:false}]}, // {level:600, pro:[{isPic:false, name:'邵干净' }, {isPic:true, name:'油焖大虾', isShipu:true}]}, // {level:650, pro:[ {isPic:true, name:'收款码', isShipu:false }]}, // {level:700, pro:[{isPic:false, name:'宋的快' }, {isPic:true, name:'酸溜土豆丝', isShipu:true}]}, // {level:750, pro:[ {isPic:true, name:'垃圾桶', isShipu:false }]}, // {level:800, pro:[{isPic:false, name:'水萌' }, {isPic:true, name:'东坡肉', isShipu:true}]}, // {level:850, pro:[ {isPic:true, name:'电灯' , isShipu:false}]}, // {level:900, pro:[{isPic:false, name:'可微' }, {isPic:true, name:'清炖饕餮蹄',isShipu:true }]}, // {level:950, pro:[ {isPic:true, name:'风扇', isShipu:false }]}, // {level:1000, pro:[{isPic:false, name:'花传单' }, {isPic:true, name:'铁锅炖大鹅',isShipu:true }]}, // {level:1100, pro:[{isPic:true, name:'九转大肠', isShipu:true}]}, //{isPic:false, name:'夏彤' }, // {level:1200, pro:[{isPic:false, name:'以南' }, {isPic:true, name:'菠萝排骨', isShipu:true}]}, // {level:1300, pro:[{isPic:false, name:'保平安' }, {isPic:true, name:'满汉全席',isShipu:true }]}, // {level:1400, pro:[ {isPic:false, name:'悦澄'}]}, // {level:1500, pro:[ {isPic:false, name:'夏彤'} ]}, // {level:1600, pro:[ {isPic:false, name:'紫琳'}]}, // {level:1700, pro:[ {isPic:false, name:'习婉工'}]}, // {level:1800, pro:[ {isPic:false, name:'羽婷'}]}, // {level:1900, pro:[ {isPic:true, name:'灯带', isShipu:false}]}, // {level:2000, pro:[ {isPic:false, name:'梵音' }]}, // {level:2100, pro:[ {isPic:true, name:'招牌' , isShipu:false}]}, // {level:2200, pro:[ {isPic:false, name:'诗锦' }]}, // {level:2300, pro:[ {isPic:true, name:'折耳根炒香菜', isShipu:true}]}, // {level:3000, pro:[ {isPic:true, name:'爆炒灵兽肉', isShipu:true}]}, // { level: 10, pro: [{ isPic: false, name: '云欣' }] }, // { level: 50, pro: [{ isPic: false, name: '媱安' }] }, // { level: 100, pro: [{ isPic: false, name: '诗涵' }] }, // { level: 200, pro: [{ isPic: false, name: '婉仪' }] }, // { level: 300, pro: [{ isPic: false, name: '诺依' }] }, // { level: 350, pro: [] }, // { level: 400, pro: [{ isPic: false, name: '班的多' }] }, // { level: 450, pro: [] }, // { level: 500, pro: [{ isPic: false, name: '蕾蕾' }] }, // { level: 550, pro: [{ isPic: true, name: '海报', isShipu: false }] }, // { level: 600, pro: [{ isPic: false, name: '邵干净' }] }, // { level: 650, pro: [] }, // { level: 700, pro: [{ isPic: false, name: '宋的快' }] }, // { level: 750, pro: [] }, // { level: 800, pro: [{ isPic: false, name: '水萌' }] }, // { level: 850, pro: [] }, // { level: 900, pro: [{ isPic: false, name: '可微' }] }, // { level: 950, pro: [] }, // { level: 1000, pro: [{ isPic: false, name: '花传单' }] }, // { level: 1100, pro: [] }, //{isPic:false, name:'夏彤' }, // { level: 1200, pro: [{ isPic: false, name: '以南' }] }, // { level: 1300, pro: [{ isPic: false, name: '保平安' }] }, // { level: 1400, pro: [{ isPic: false, name: '悦澄' }] }, // { level: 1500, pro: [{ isPic: false, name: '夏彤' }] }, // { level: 1600, pro: [{ isPic: false, name: '紫琳' }] }, // { level: 1700, pro: [{ isPic: false, name: '习婉工' }] }, // { level: 1800, pro: [{ isPic: false, name: '羽婷' }] }, // { level: 1900, pro: [] }, // { level: 2000, pro: [{ isPic: false, name: '梵音' }] }, // { level: 2100, pro: [] }, // { level: 2200, pro: [{ isPic: false, name: '诗锦' }] }, // { level: 2300, pro: [] }, // { level: 3000, pro: [] }, // { level: 100, pro: [{ isPic: false, name: '云欣' }, { isPic: true, name: '牛肉拉面', isShipu: true }] }, // { level: 150, pro: [{ isPic: false, name: '媱安' }] }, // { level: 200, pro: [{ isPic: false, name: '诗涵' }, { isPic: true, name: '油泼面', isShipu: true }, { isPic: true, name: '擀面杖', isShipu: false }] }, // { level: 300, pro: [{ isPic: false, name: '婉仪' }, { isPic: true, name: '海鲜面', isShipu: true }, { isPic: true, name: '砧板', isShipu: false }] }, // { level: 350, pro: [{ isPic: true, name: '馒头', isShipu: true }] }, // { level: 400, pro: [{ isPic: false, name: '诺依' }, { isPic: true, name: '烧麦', isShipu: true }, { isPic: true, name: '面锅', isShipu: false }] }, // { level: 450, pro: [{ isPic: true, name: '春卷', isShipu: true }] }, // { level: 500, pro: [{ isPic: false, name: '晴萱' }, { isPic: true, name: '龙须面', isShipu: true }, { isPic: true, name: '漏勺', isShipu: false }] }, // { level: 500, pro: [{ isPic: true, name: '百合酥', isShipu: true }] }, // { level: 600, pro: [{ isPic: false, name: '蕾蕾' }, { isPic: true, name: '鲜肉馄饨', isShipu: true }, { isPic: true, name: '汤勺', isShipu: false }] }, // { level: 650, pro: [{ isPic: true, name: '刀削面', isShipu: true }] }, // { level: 700, pro: [{ isPic: false, name: '水萌' }, { isPic: true, name: '猫耳朵', isShipu: true }, { isPic: true, name: '摆摊车', isShipu: false }] }, // { level: 750, pro: [{ isPic: true, name: '铜锣烧', isShipu: true }] }, // { level: 800, pro: [{ isPic: false, name: '可微' }, { isPic: true, name: '意面', isShipu: true }, { isPic: true, name: '调料盒', isShipu: false }] }, // { level: 850, pro: [{ isPic: true, name: '热干面', isShipu: true }] }, // { level: 900, pro: [{ isPic: false, name: '以南' }, { isPic: true, name: '三鲜饺子', isShipu: true }, { isPic: true, name: '长筷子', isShipu: false }] }, // { level: 950, pro: [{ isPic: true, name: '栗子酥', isShipu: true }] }, // { level: 1000, pro: [{ isPic: false, name: '悦澄' }, { isPic: true, name: '龙须酥', isShipu: true }] }, // { level: 1050, pro: [{ isPic: true, name: '椒盐酥', isShipu: true }] }, // { level: 1100, pro: [{ isPic: false, name: '夏彤' }, { isPic: true, name: '杏仁酥', isShipu: true }] }, // { level: 1150, pro: [{ isPic: true, name: '灌汤包', isShipu: true }] }, // { level: 1200, pro: [{ isPic: false, name: '紫琳' }, { isPic: true, name: '多味茶酥', isShipu: true }, { isPic: true, name: '抹布', isShipu: false }] }, // { level: 1250, pro: [{ isPic: true, name: '金丝面', isShipu: true }] }, // { level: 1300, pro: [{ isPic: false, name: '羽婷' }, { isPic: true, name: '小笼包', isShipu: true }] }, // { level: 1350, pro: [{ isPic: true, name: '水晶饺子', isShipu: true }] }, // { level: 1400, pro: [{ isPic: false, name: '梵音' }, { isPic: true, name: '煎饺', isShipu: true }] }, // { level: 1450, pro: [{ isPic: true, name: '抄手', isShipu: true }] }, // { level: 1500, pro: [{ isPic: false, name: '诗锦' }, { isPic: true, name: '鲜花饼', isShipu: true }, { isPic: true, name: '煤气灶', isShipu: false }] }, // { level: 1800, pro: [{ isPic: true, name: '招牌', isShipu: false }] }, // { level: 2000, pro: [{ isPic: false, name: '绮罗' }] }, ] export default class LevelUpManager { //等级系数 public static levelArray = [ 1.06, 1.06, 1.033, 1.035, 1.025, 1.042, 1.028, 1.028, 1.03, 1.032, 1.028, 1.04, 1.013, 1.02, 1.042, 1.01, 1.04, 1.04, 1.04, 1.04, 1.01, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, 1.047, ] //收益系数 public static incomeArray = [ 1.015, 1.015, 1.012, 1.02, 1.013, 1.012, 1.022, 1.05, 1.012, 1.025, 1.015, 1.015, 1.025, 1.015, 1.015, 1.025, 1.015, 1.015, 1.016, 1.016, 1.025, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, 1.02, ] public static adRewardArray = [ 8, 8, 8, 6, 6, 6, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ] public static adRewardArray2 = [ 6, 6, 6, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, ] //宝箱 public static adRewardArrayBox = [ 8, 8, 8, 6, 6, 6, 6, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, ] public static qipaoAddLevelNum = [ 35, 23, 30, 28, 25, 23, 22, 16, 15, 15, 13, 12, 13, 13, 15, 12, 13, 15, 12, 13, 12, 14, 12, 13, 13, 12, 13, 12, 13, 12, 15, 12, 15, 12, 15, 12, 15, 12, 15, 12, 12, 15, 12, 15, 12, 15, 12, 15, 12, 15, 12, 15, 12, 15, 12, 15, 12, 15, 12, 15, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, ] public static getQipaoAddLevelNum() { let level = User.getMyLevel() let index = Math.floor(level / 50) let num = this.qipaoAddLevelNum[index] return num } //食神送财 public static getAdReardMoneySC() { let monry = this.levelUpSpned() let level = User.getMyLevel() let index = Math.floor(level / 100) let xishu = this.adRewardArray[index] return monry * xishu } //食神赐福 public static getAdReardMoneySS() { let monry = this.levelUpSpned() let level = User.getMyLevel() let index = Math.floor(level / 100) let xishu = this.adRewardArray2[index] return monry * xishu } // update (dt) {} public static levelUpSpned() { let level = User.getMyLevel() // let index = Math.floor(level / 100) // if (index == 0) { // let xishu = this.levelArray[index] // let tempNum = 110 // let yushuLevel = level // let powNum = Math.pow(xishu, yushuLevel - 1) // let spendMoney = Math.ceil(tempNum * powNum) // return spendMoney // } else if (index > 0) { // let xishu = this.levelArray[index] // let yushuLevel = level % 100 // let powNum = Math.pow(xishu, yushuLevel) // let tempNum = 110 // let addNum = 1 // for (let i = 0; i < index; i++) { // let xishu = this.levelArray[i] // addNum = addNum * Math.pow(xishu, 99) // } // let spendMoney = Math.ceil(tempNum * powNum * addNum) // return spendMoney // } let spendMoney = Math.ceil(18 * Math.pow(1.046, level - 1)) return spendMoney } public static clickInComeMoney() { let level = User.getMyLevel() let index = Math.floor(level / 100) if (index == 0) { let xishu = this.incomeArray[index] let tempNum = 200 let yushuLevel = level let powNum = Math.pow(xishu, yushuLevel - 1) let imcomeMoney = Math.ceil(tempNum * powNum) return imcomeMoney } else if (index > 0) { let xishu = this.incomeArray[index] let yushuLevel = level % 100 let powNum = Math.pow(xishu, yushuLevel) let tempNum = 200 let addNum = 1 for (let i = 0; i < index; i++) { let xishu = this.incomeArray[i] addNum = addNum * Math.pow(xishu, 99) } let imcomeMoney = Math.ceil(tempNum * powNum * addNum) return imcomeMoney } } public static peopleLevelUp(addLevel = 1) { let level = User.getMyLevel() level += addLevel let jiesuoArray = User.getLevelupJieSuoArray() let dataPro = null let chooseIndex = -1 for (let i = 0; i < jiesuoProConfig.length; i++) { let data = jiesuoProConfig[i] let dataLevel = data.level if (level >= dataLevel) { chooseIndex = i dataPro = data.pro } } if (jiesuoArray[chooseIndex] == 1) { dataPro = null } else { if (chooseIndex != -1) { jiesuoArray[chooseIndex] = 1 User.setLevelupJieSuoArray(jiesuoArray) } } if (level >= 5000) { level = 5000 } User.setMyLevel(level) if (level >= 200 && level <= 300) { for (let index = 200; index <= 300; index += 10) { if (level == index) { console.log(`等级提升-等级提升至${level}`) Common5.ReportDY("inLevel", `等级提升-等级提升至${level}`) break } } } EventMgr.emitEvent_custom(ryw_Event.levelUpChange) return dataPro } public static isPeopleLevelUpMax() { let level = User.getMyLevel() if (level >= 5000) { return true } else { return false } } public static getChengHao() { let level = User.getMyLevel() let str = '' chenghaoConfig.forEach(element => { if (level >= element.level) { str = element.chenghaoStr } }); return str } public static getChengHaoId() { let level = User.getMyLevel() let id = 0 let getChuShiXieHuiLevel = User.getChuShiXieHuiLevel() if (getChuShiXieHuiLevel[0] == 1) { id = 3 } if (getChuShiXieHuiLevel[2] == 1) { id = 4 } if (getChuShiXieHuiLevel[3] == 1) { id = 5 } if (getChuShiXieHuiLevel[5] == 1) { id = 6 } if (getChuShiXieHuiLevel[7] == 1) { id = 7 } if (id == 0) { for (let i = 0; i < 3; i++) { if (level >= chenghaoConfig[i].level) { id = chenghaoConfig[i].id } } // chenghaoConfig.forEach(element => { // if (level >= element.level) { // id = element.id // } // }); } return id } public static getAllChengHaoinCome() { let level = User.getMyLevel() let beishu = 0 let getChuShiXieHuiLevel = User.getChuShiXieHuiLevel() if (getChuShiXieHuiLevel[0] == 1) { beishu = chenghaoConfig[3].inComeMultiple } if (getChuShiXieHuiLevel[2] == 1) { beishu = chenghaoConfig[4].inComeMultiple } if (getChuShiXieHuiLevel[3] == 1) { beishu = chenghaoConfig[5].inComeMultiple } if (getChuShiXieHuiLevel[5] == 1) { beishu = chenghaoConfig[6].inComeMultiple } if (getChuShiXieHuiLevel[7] == 1) { beishu = chenghaoConfig[7].inComeMultiple } if (beishu == 0) { for (let i = 0; i < 3; i++) { if (level >= chenghaoConfig[i].level) { beishu = chenghaoConfig[i].inComeMultiple } } // chenghaoConfig.forEach(element => { // if (level >= element.level) { // beishu = element.inComeMultiple // } // }); } if (beishu == 0) { beishu = 1 } return beishu } public static getChengHaoinComeById(id) { let beishu = 0 chenghaoConfig.forEach(element => { if (id == element.id) { beishu = element.inComeMultiple } }); return beishu } //当前点击收益 public static getCurClickIncome() { let clickInComeMoney = LevelUpManager.clickInComeMoney()//人物点击收益(按等级算的) let jiachengGY = MiShuManager.getMishuAllClickInCome()//属性秘书加成百分比 // let jiachengTw = TanWeiManager.getAllClickInCome()//属性摊位加成百分比 let dianjiNum = User.getClickIncomeNum()//出摊界面的点击收益按钮倍数 let jiachengBeishu = 0 if (jiachengGY != 0) { jiachengBeishu = (jiachengBeishu + jiachengGY + 1)//属性秘书收益百分比+1 } // if (jiachengTw != 0) { // jiachengBeishu = (jiachengBeishu + jiachengTw + 1)//属性摊位加成百分比+1 // } if (jiachengBeishu != 0) { clickInComeMoney = clickInComeMoney * (jiachengBeishu) ///等级收益倍数(称号倍数) * 属性秘书加成属性摊位加成 } if (dianjiNum == 0) { dianjiNum = 1 } let fanbei = User.getShouyiFanbeiNum()//出摊界面的收益翻倍按钮倍数 let beishuTW = TanWeiManager.getAllShipuInCome() //摊位界面的物品点击加成 let chenghaoInCome = LevelUpManager.getAllChengHaoinCome() //称号倍数 //(等级收益(称号收益) * 属性秘书加成 属性摊位加成 )* 出摊界面的点击收益按钮倍数 * 出摊界面的收益翻倍 * 摊位界面的物品点击加成 * 称号倍数 return clickInComeMoney * dianjiNum * fanbei * beishuTW * chenghaoInCome } public static getShouyi() { let clickIncomeNum = User.getClickIncomeNum() if (clickIncomeNum >= 20) { return Math.ceil(clickIncomeNum * 1.1) } else { if (clickIncomeNum < 4) { return clickIncomeNum + 2 } else { return clickIncomeNum + 2 } } } public static canLevelNum(spendMoney) { let levelUpNum = 0 let level = User.getMyLevel() while (spendMoney > 0) { let index = Math.floor(level / 100) if (index == 0) { let xishu = this.levelArray[index] let tempNum = 110 let yushuLevel = level let powNum = Math.pow(xishu, yushuLevel - 1) let money = Math.ceil(tempNum * powNum) spendMoney -= money levelUpNum++ level++ } else if (index > 0) { let xishu = this.levelArray[index] let yushuLevel = level % 100 let powNum = Math.pow(xishu, yushuLevel) let tempNum = 110 let addNum = 1 for (let i = 0; i < index; i++) { let xishu = this.levelArray[i] addNum = addNum * Math.pow(xishu, 99) } let money = Math.ceil(tempNum * powNum * addNum) spendMoney -= money levelUpNum++ level++ } } return levelUpNum } public static getChenghaoConfig() { return chenghaoConfig } public static getChenghaoConfigById(id) { let config chenghaoConfig.forEach(element => { if (id == element.id) { config = element } }); return config } }