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.
776 lines
29 KiB
776 lines
29 KiB
// 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 TaskManager from "../JuQingChat/TaskManager"
|
|
|
|
|
|
|
|
//mishuType 0秘书1队友 ,lockLevel上个队友的级别需要多少级
|
|
//mishuType 0秘书1队友 ,lockLevel上个队友的级别需要多少级
|
|
let configData = [
|
|
{mishuId:0, addPercent:2.0, spineName:'右一',spineName2:'待机', mishuLevel:0, mishuType:0, name:'云欣',selfLevel:1, selfLevelStr:'',lockLevel:0, lockLevelStr:'茜滢10级时解锁',lockMoney:0 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:1, addPercent:1.5, spineName:'左一',spineName2:'待机', mishuLevel:0, mishuType:0, name:'茜滢',selfLevel:50, selfLevelStr:'主角50级时解锁',lockLevel:0, lockLevelStr:'云欣10级时解锁',lockMoney:25500 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:2, addPercent:2.5, spineName:'中间1',spineName2:'中间1', mishuLevel:0, mishuType:0, name:'媱安',selfLevel:100, selfLevelStr:'主角100级时解锁',lockLevel:0, lockLevelStr:'云欣10级时解锁',lockMoney:60000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:3, addPercent:3.0, spineName:'中间2',spineName2:'中间2', mishuLevel:0, mishuType:0, name:'诗涵',selfLevel:150, selfLevelStr:'主角150级时解锁',lockLevel:0, lockLevelStr:'媱安10级时解锁',lockMoney:180000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:4, addPercent:3.0, spineName:'中间4',spineName2:'中间4', mishuLevel:0, mishuType:0, name:'婉仪',selfLevel:200, selfLevelStr:'主角200级时解锁',lockLevel:0, lockLevelStr:'诗涵10级时解锁',lockMoney:480000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:5, addPercent:3.5, spineName:'中间3',spineName2:'中间3', mishuLevel:0, mishuType:0, name:'诺依',selfLevel:250, selfLevelStr:'主角250级时解锁',lockLevel:0, lockLevelStr:'婉仪10级时解锁',lockMoney:1350000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:6, addPercent:4.0, spineName:'最后1',spineName2:'最后1', mishuLevel:0, mishuType:0, name:'晴萱',selfLevel:300, selfLevelStr:'主角300级时解锁',lockLevel:0, lockLevelStr:'诺依10级时解锁',lockMoney:3600000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:7, addPercent:4.5, spineName:'最后2',spineName2:'最后2', mishuLevel:0, mishuType:0, name:'蕾蕾',selfLevel:350, selfLevelStr:'主角350级时解锁',lockLevel:0, lockLevelStr:'晴萱10级时解锁',lockMoney:9600000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:8, addPercent:5.0, spineName:'最后6',spineName2:'最后6', mishuLevel:0, mishuType:0, name:'水萌',selfLevel:400, selfLevelStr:'主角400级时解锁',lockLevel:0, lockLevelStr:'蕾蕾10级时解锁',lockMoney:25800000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:9, addPercent:6.0, spineName:'最后3',spineName2:'最后3', mishuLevel:0, mishuType:0, name:'可微',selfLevel:450, selfLevelStr:'主角450级时解锁',lockLevel:0, lockLevelStr:'水萌10级时解锁',lockMoney:69000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:10, addPercent:8.0, spineName:'最后4',spineName2:'最后4', mishuLevel:0, mishuType:0, name:'以南',selfLevel:500, selfLevelStr:'主角500级时解锁',lockLevel:0, lockLevelStr:'可微10级时解锁',lockMoney:189000000, isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:11, addPercent:10.0, spineName:'秘书2',spineName2:'秘书2', mishuLevel:0, mishuType:0, name:'悦澄',selfLevel:550, selfLevelStr:'主角550级时解锁',lockLevel:0, lockLevelStr:'以南10级时解锁',lockMoney:510000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:12, addPercent:15.0, spineName:'最后5',spineName2:'最后5', mishuLevel:0, mishuType:0, name:'夏彤',selfLevel:600, selfLevelStr:'主角600级时解锁',lockLevel:0, lockLevelStr:'悦澄10级时解锁',lockMoney:1350000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:13, addPercent:50.0, spineName:'秘书4',spineName2:'秘书4', mishuLevel:0, mishuType:0, name:'紫琳',selfLevel:650, selfLevelStr:'主角650级时解锁',lockLevel:0, lockLevelStr:'夏彤10级时解锁',lockMoney:3600000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:14, addPercent:100.0, spineName:'秘书6',spineName2:'秘书6', mishuLevel:0, mishuType:0, name:'羽婷',selfLevel:700, selfLevelStr:'主角700级时解锁',lockLevel:0, lockLevelStr:'紫琳10级时解锁',lockMoney:9600000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:15, addPercent:150.0, spineName:'秘书5',spineName2:'秘书5', mishuLevel:0, mishuType:0, name:'梵音',selfLevel:750, selfLevelStr:'主角750级时解锁',lockLevel:0, lockLevelStr:'羽婷10级时解锁',lockMoney:26400000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:16, addPercent:200.0, spineName:'秘书3',spineName2:'秘书3', mishuLevel:0, mishuType:0, name:'诗锦',selfLevel:800, selfLevelStr:'主角800级时解锁',lockLevel:0, lockLevelStr:'梵音10级时解锁',lockMoney:69000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:17, addPercent:300.0, spineName:'秘书1',spineName2:'秘书1', mishuLevel:0, mishuType:0, name:'绮罗',selfLevel:850, selfLevelStr:'主角850级时解锁',lockLevel:0, lockLevelStr:'诗锦10级时解锁',lockMoney:192000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
|
|
{mishuId:18,addPercent:50.0, mishuLevel:0, spineName:'工人', spineName2:'animation', mishuType:1, name:'班的多',selfLevel:1000, selfLevelStr:'主角1000级时解锁',lockLevel:0, lockLevelStr:'主角400级时解锁',lockMoney:5000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:19,addPercent:800.0, mishuLevel:0, spineName:'环卫', spineName2:'animation', mishuType:1, name:'邵干净',selfLevel:1200, selfLevelStr:'主角1200级时解锁',lockLevel:20, lockLevelStr:'班的多20级时解锁',lockMoney:150000000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:20,addPercent:5000.0, mishuLevel:0, spineName:'外卖',spineName2:'animation', mishuType:1, name:'宋的快',selfLevel:700, selfLevelStr:'主角700级时解锁',lockLevel:20, lockLevelStr:'邵干净20级时解锁',lockMoney:15000000000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:21,addPercent:4500000.0, mishuLevel:0, spineName:'发传单',spineName2:'animation', mishuType:1, name:'花传单',selfLevel:1000, selfLevelStr:'主角1000级时解锁',lockLevel:20, lockLevelStr:'宋的快20级时解锁',lockMoney:25000000000000000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:22,addPercent:3000000000.0, mishuLevel:0, spineName:'保安',spineName2:'animation', mishuType:1, name:'保平安',selfLevel:1300, selfLevelStr:'主角1300级时解锁',lockLevel:20, lockLevelStr:'花传单20级时解锁',lockMoney:30000000000000000000000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:23,addPercent:150000000000.0, mishuLevel:0, spineName:'洗碗',spineName2:'animation', mishuType:1, name:'习婉工',selfLevel:1700, selfLevelStr:'主角1700级时解锁',lockLevel:20, lockLevelStr:'保平安20级时解锁',lockMoney:250000000000000000000000000000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
{mishuId:24,addPercent:40000000.0, mishuLevel:0, spineName:'富豪待机',spineName2:'待机', mishuType:1, name:'钱多发',selfLevel:1100, selfLevelStr:'主角1100级时解锁',lockLevel:0, lockLevelStr:'主角1100级时解锁',lockMoney:2000000000000000000000000 , isLock:true, isSign:false , isNeedTask:-1},
|
|
]
|
|
|
|
let peixunShoiyi = [
|
|
{peixunLevel:1, incomeMutiple:1},
|
|
{peixunLevel:2, incomeMutiple:3},
|
|
{peixunLevel:3, incomeMutiple:5},
|
|
{peixunLevel:4, incomeMutiple:8},
|
|
{peixunLevel:5, incomeMutiple:10},
|
|
{peixunLevel:6, incomeMutiple:13},
|
|
{peixunLevel:7, incomeMutiple:15},
|
|
{peixunLevel:8, incomeMutiple:18},
|
|
{peixunLevel:9, incomeMutiple:20},
|
|
{peixunLevel:10, incomeMutiple:23},
|
|
{peixunLevel:11, incomeMutiple:25},
|
|
{peixunLevel:12, incomeMutiple:28},
|
|
{peixunLevel:13, incomeMutiple:30},
|
|
|
|
]
|
|
|
|
|
|
export default class MiShuManager {
|
|
public static mishuShouyiStart = [
|
|
211,568,1529,4116,11080,
|
|
29822,80269,216052,581523,1565221,
|
|
4212930,11339473,30521189,82150469,221115219,
|
|
595151078,1601901517,80000000000000000,2700000,150000000,
|
|
3000000000,20000000000000,170000000000000000,7000000000000000000000000,400000000000000,0,0,0,0,0,
|
|
]
|
|
//秘书加成等级 incomeNum每秒收益
|
|
public static initManager(){
|
|
let mishuList = User.getMishuList()
|
|
if(mishuList.length == 0){
|
|
for(let i =0; i<configData.length; i++){
|
|
let config = configData[i]
|
|
if(config.mishuType == 0){
|
|
let obj = {mishuId:0, mishuLevel:0, isLock:true, is20Reward: false}
|
|
obj.mishuId = config.mishuId
|
|
mishuList.push(obj)
|
|
}
|
|
}
|
|
User.setMishuList(mishuList)
|
|
}
|
|
|
|
|
|
let duiyouList = User.getDuiyouList()
|
|
if(duiyouList.length == 0){
|
|
for(let i =0; i<configData.length; i++){
|
|
let config = configData[i]
|
|
if(config.mishuType == 1){
|
|
let obj = {mishuId:0, mishuLevel:0, isLock:true, is20Reward: false}
|
|
obj.mishuId = config.mishuId
|
|
duiyouList.push(obj)
|
|
}
|
|
}
|
|
User.setDuiyouList(duiyouList)
|
|
}
|
|
}
|
|
public static getManagerConfigDate(){
|
|
return configData
|
|
|
|
}
|
|
|
|
|
|
public static getConfigDateByName(name){
|
|
for(let i =0; i<configData.length; i++){
|
|
if(configData[i].name == name){
|
|
return configData[i]
|
|
}
|
|
}
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
public static getConfigDateById(mishuId){
|
|
for(let i =0; i<configData.length; i++){
|
|
if(configData[i].mishuId == mishuId){
|
|
return configData[i]
|
|
}
|
|
}
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
//获取是不是可以增加点击收益
|
|
public static getMishuClickInCome(mishuId){
|
|
let userDate = MiShuManager.getMishuUserDateById(mishuId)
|
|
if(userDate.isLock){
|
|
//锁
|
|
return false
|
|
}else{
|
|
if(userDate.mishuLevel>=20){
|
|
return true
|
|
}else{
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
|
|
public static getMishuAllClickInCome(){
|
|
let jiacheng = 0
|
|
let jiachengPercent = 0
|
|
let mishuList = User.getMishuList()
|
|
let duiyouList = User.getDuiyouList()
|
|
for(let i = 0; i<mishuList.length;i++){
|
|
let isCan = this.getMishuClickInCome(mishuList[i].mishuId)
|
|
|
|
let configDate = this.getConfigDateById(mishuList[i].mishuId)
|
|
if(isCan){
|
|
jiachengPercent+=(configDate.addPercent*100)
|
|
}
|
|
|
|
|
|
}
|
|
for(let i = 0; i<duiyouList.length;i++){
|
|
let isCan = this.getMishuClickInCome(duiyouList[i].mishuId)
|
|
let configDate = this.getConfigDateById(duiyouList[i].mishuId)
|
|
if(isCan){
|
|
jiachengPercent+=(configDate.addPercent*100)
|
|
}
|
|
|
|
}
|
|
|
|
return Math.ceil(jiachengPercent/100)
|
|
|
|
}
|
|
|
|
|
|
|
|
public static getMishuUserDateById(mishuId){
|
|
let curUserDate = null
|
|
let mishuList = User.getMishuList()
|
|
let duiyouList = User.getDuiyouList()
|
|
for(let i = 0; i<mishuList.length;i++){
|
|
if(mishuList[i].mishuId == mishuId){
|
|
curUserDate = mishuList[i]
|
|
break
|
|
|
|
}
|
|
}
|
|
if(curUserDate==null){
|
|
for(let i = 0; i<duiyouList.length;i++){
|
|
if(duiyouList[i].mishuId == mishuId){
|
|
curUserDate = duiyouList[i]
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
return curUserDate
|
|
|
|
}
|
|
|
|
//判断当前秘书是不是可以解锁
|
|
public static getMishuIsLockById(mishuId){
|
|
let curUserDate = this.getMishuUserDateById(mishuId)
|
|
let configdate = this.getConfigDateById(mishuId)
|
|
if(curUserDate){
|
|
if(curUserDate.isLock){
|
|
//是否需要上个等级解锁, 是否需要主角等级解锁。钱不是问题,可以看广告解锁
|
|
let selfLevel = configdate.selfLevel
|
|
let lockLevel = configdate.lockLevel
|
|
let myLevel = User.getMyLevel()
|
|
|
|
let condition1 = false
|
|
if(myLevel>=selfLevel) {
|
|
condition1 = true
|
|
}
|
|
|
|
|
|
let condition2 = false
|
|
if(lockLevel == 0){
|
|
condition2 = true
|
|
}else{
|
|
let prevDate = this.getMishuUserDateById(mishuId-1)
|
|
let prevLevel = prevDate.mishuLevel
|
|
if(prevLevel>=lockLevel){
|
|
condition2 = true
|
|
}
|
|
}
|
|
|
|
let condition3 = false
|
|
if(!configdate.isSign){
|
|
condition3 = true
|
|
}else{
|
|
condition3 = false
|
|
}
|
|
|
|
|
|
let condition4 = false
|
|
if(configdate.isNeedTask == -1){
|
|
condition4 = true
|
|
}else{
|
|
let taskid = configdate.isNeedTask
|
|
let taskArray = User.getCurTaskId()
|
|
if(taskArray[0]>=taskid){
|
|
condition4 = true
|
|
condition1 = true
|
|
}else{
|
|
condition4 = false
|
|
}
|
|
|
|
}
|
|
|
|
if(condition2 && condition1 && condition3 && condition4){
|
|
return true
|
|
}else{
|
|
return false
|
|
}
|
|
}else{
|
|
return false
|
|
}
|
|
}
|
|
}
|
|
|
|
//判断当前秘书升级需要的钱
|
|
public static getlevelUpMoneyById(mishuId){
|
|
let curUserDate = this.getMishuUserDateById(mishuId)
|
|
|
|
let configDate = this.getConfigDateById(mishuId)
|
|
let spendMoney = configDate.lockMoney
|
|
if(curUserDate){
|
|
let levelNum = curUserDate.mishuLevel
|
|
let lockMoney = configDate.lockMoney
|
|
let xishu = 1.32
|
|
spendMoney = Math.pow(xishu, levelNum)
|
|
spendMoney = Math.floor(lockMoney*spendMoney)
|
|
|
|
}
|
|
|
|
return spendMoney
|
|
}
|
|
|
|
|
|
//当前秘书收益
|
|
public static getIncomeById(mishuId){
|
|
let curUserDate = this.getMishuUserDateById(mishuId)
|
|
let configDate = this.getConfigDateById(mishuId)
|
|
let shouyiNum = 0
|
|
if(curUserDate){
|
|
let levelNum = curUserDate.mishuLevel
|
|
let lockMoney = this.mishuShouyiStart[mishuId]
|
|
|
|
let xishu = 1
|
|
shouyiNum = Math.pow(xishu, levelNum)
|
|
shouyiNum = Math.floor(lockMoney*shouyiNum)
|
|
|
|
}
|
|
|
|
return shouyiNum
|
|
}
|
|
|
|
//秘书总秒赚
|
|
public static getAllIncomeMishu(){
|
|
let mishuList = User.getMishuList()
|
|
let mishuPxIndex = this.getMishuPeiXunIncomeMutiple()
|
|
|
|
let fanbei = User.getShouyiFanbeiNum()
|
|
|
|
|
|
let allMoney = 0
|
|
for(let i = 0;i<mishuList.length;i++){
|
|
if(mishuList[i].isLock == false){
|
|
let money = this.getIncomeById(mishuList[i].mishuId)
|
|
allMoney+=money
|
|
}
|
|
}
|
|
return allMoney*mishuPxIndex*fanbei
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @returns 秘书秒赚的总基数
|
|
*/
|
|
public static getAllIncomeMishuMiaoZhuan(){
|
|
let mishuList = User.getMishuList()
|
|
|
|
|
|
|
|
let allMoney = 0
|
|
for(let i = 0;i<mishuList.length;i++){
|
|
if(mishuList[i].isLock == false){
|
|
let money = this.getIncomeById(mishuList[i].mishuId)
|
|
allMoney+=money
|
|
}
|
|
}
|
|
return allMoney
|
|
}
|
|
|
|
/**
|
|
*
|
|
* @returns 秘书解锁的总数量
|
|
*/
|
|
public static getAllMishuNum(){
|
|
let mishuList = User.getMishuList()
|
|
let num = 0
|
|
for(let i = 0;i<mishuList.length;i++){
|
|
if(mishuList[i].isLock == false){
|
|
num++
|
|
}
|
|
}
|
|
return num
|
|
}
|
|
|
|
//队友总秒赚
|
|
public static getAllIncomeDuiyou(){
|
|
let duiyouList = User.getDuiyouList()
|
|
let allMoney = 0
|
|
let duiyouPxIndex = this.getDuiyouPeiXunIncomeMutiple()
|
|
let fanbei = User.getShouyiFanbeiNum()
|
|
|
|
|
|
for(let i = 0;i<duiyouList.length;i++){
|
|
if(duiyouList[i].isLock == false){
|
|
let money = this.getIncomeById(duiyouList[i].mishuId)
|
|
allMoney+=money
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return allMoney*duiyouPxIndex*fanbei
|
|
}
|
|
|
|
//解锁
|
|
// {mishuId:0, mishuLevel:0, isLock:true}
|
|
public static setMishuLock(mishuId, isMishu, isLock=false){
|
|
let isEmitEvent = false
|
|
if(isMishu){
|
|
let mishuList = User.getMishuList()
|
|
for(let i = 0; i<mishuList.length;i++){
|
|
if(mishuList[i].mishuId == mishuId){
|
|
mishuList[i].mishuLevel = 1
|
|
mishuList[i].isLock = isLock
|
|
isEmitEvent = true
|
|
break
|
|
|
|
}
|
|
}
|
|
User.setMishuList(mishuList)
|
|
}else{
|
|
let duiyouList = User.getDuiyouList()
|
|
for(let i = 0; i<duiyouList.length;i++){
|
|
if(duiyouList[i].mishuId == mishuId){
|
|
duiyouList[i].mishuLevel = 1
|
|
duiyouList[i].isLock = isLock
|
|
isEmitEvent = true
|
|
break
|
|
}
|
|
}
|
|
User.setDuiyouList(duiyouList)
|
|
}
|
|
|
|
if(isEmitEvent){
|
|
EventMgr.emitEvent_custom(ryw_Event.mishuLock);
|
|
}
|
|
}
|
|
|
|
public static isMaxLevel(mishuId){
|
|
let curUserDate = this.getMishuUserDateById(mishuId)
|
|
let maxLevel = 100
|
|
if( curUserDate.mishuLevel>=maxLevel){
|
|
return true
|
|
}else{
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
//升级
|
|
public static upDateMishuLevelUp(mishuId, isMishu, levelNum = 1){
|
|
let maxLevel = 100
|
|
let isEmitEvent = false
|
|
let isFirst20 = false
|
|
if(isMishu){
|
|
let mishuList = User.getMishuList()
|
|
for(let i = 0; i<mishuList.length;i++){
|
|
if(mishuList[i].mishuId == mishuId){
|
|
mishuList[i].mishuLevel+=levelNum
|
|
if( mishuList[i].mishuLevel>=maxLevel){
|
|
mishuList[i].mishuLevel = 100
|
|
}
|
|
|
|
if( mishuList[i].mishuLevel>=20 && mishuList[i].is20Reward == false){
|
|
mishuList[i].is20Reward = true
|
|
isFirst20 = true
|
|
}
|
|
|
|
isEmitEvent = true
|
|
break
|
|
|
|
}
|
|
}
|
|
User.setMishuList(mishuList)
|
|
}else{
|
|
let duiyouList = User.getDuiyouList()
|
|
for(let i = 0; i<duiyouList.length;i++){
|
|
if(duiyouList[i].mishuId == mishuId){
|
|
duiyouList[i].mishuLevel+=levelNum
|
|
if( duiyouList[i].mishuLevel>=maxLevel){
|
|
duiyouList[i].mishuLevel = 100
|
|
}
|
|
if( duiyouList[i].mishuLevel>=20 && duiyouList[i].is20Reward == false){
|
|
isFirst20 = true
|
|
duiyouList[i].is20Reward = true
|
|
}
|
|
isEmitEvent = true
|
|
break
|
|
}
|
|
}
|
|
User.setDuiyouList(duiyouList)
|
|
}
|
|
|
|
if(isEmitEvent){
|
|
EventMgr.emitEvent_custom(ryw_Event.mishuLevelUp);
|
|
}
|
|
|
|
return isFirst20
|
|
}
|
|
|
|
//获取培训收益
|
|
public static getMishuPeiXunConfig(){
|
|
return peixunShoiyi
|
|
}
|
|
|
|
public static getPeixunIncomeMutiple(peixunLevel){
|
|
for(let i = 0; i<peixunShoiyi.length;i++){
|
|
if(peixunShoiyi[i].peixunLevel == peixunLevel){
|
|
return peixunShoiyi[i].incomeMutiple
|
|
}
|
|
}
|
|
return 1
|
|
}
|
|
|
|
public static getPeixunIncomeMutipleConfig(peixunLevel){
|
|
for(let i = 0; i<peixunShoiyi.length;i++){
|
|
if(peixunShoiyi[i].peixunLevel == peixunLevel){
|
|
return peixunShoiyi[i]
|
|
}
|
|
}
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
|
//'Mishu' //Duiyou
|
|
public static isMaxPeixunLavel(gameType = 'Mishu'){
|
|
let MAX = 13
|
|
let mishu = User.getMishuPeiXunLevel()
|
|
let duiyou = User.getDuiyouPeiXunLevel()
|
|
let curLevel = 0
|
|
if(gameType == 'Mishu'){
|
|
curLevel = mishu
|
|
}else{
|
|
curLevel = duiyou
|
|
}
|
|
|
|
if(curLevel>=MAX){
|
|
return true
|
|
}else{
|
|
return false
|
|
}
|
|
|
|
}
|
|
|
|
public static getMishuPeiXunIncomeMutiple(){
|
|
let mishu = User.getMishuPeiXunLevel()
|
|
let num = this.getPeixunIncomeMutiple(mishu)
|
|
return num
|
|
}
|
|
|
|
public static getDuiyouPeiXunIncomeMutiple(){
|
|
let duiyou = User.getDuiyouPeiXunLevel()
|
|
let num = this.getPeixunIncomeMutiple(duiyou)
|
|
return num
|
|
}
|
|
|
|
public static getPeiXunLevel(gameType = 'Mishu'){
|
|
if(gameType == 'Mishu'){
|
|
let mishu = User.getMishuPeiXunLevel()
|
|
return mishu
|
|
}else{
|
|
let duiyou = User.getDuiyouPeiXunLevel()
|
|
return duiyou
|
|
}
|
|
}
|
|
|
|
public static setPeiXunLevel( levelNum, gameType = 'Mishu'){
|
|
if(gameType == 'Mishu'){
|
|
User.setMishuPeiXunLevel(levelNum)
|
|
}else{
|
|
User.setDuiyouPeiXunLevel(levelNum)
|
|
}
|
|
//EventMgr.emitEvent_custom(ryw_Event.mishuLevelUp);
|
|
}
|
|
|
|
public static getUnLockNum(){
|
|
let num = 0
|
|
let mishuList = User.getMishuList()
|
|
for(let i = 0;i<mishuList.length;i++){
|
|
if(mishuList[i].isLock == false){
|
|
num++
|
|
}
|
|
}
|
|
|
|
let duiyouList = User.getDuiyouList()
|
|
for(let i = 0;i<duiyouList.length;i++){
|
|
if(duiyouList[i].isLock == false){
|
|
num++
|
|
}
|
|
}
|
|
|
|
return num
|
|
}
|
|
|
|
public static getUnLockMishuNum(){
|
|
let num = 0
|
|
let mishuList = User.getMishuList()
|
|
for(let i = 0;i<mishuList.length;i++){
|
|
if(mishuList[i].isLock == false){
|
|
num++
|
|
}
|
|
}
|
|
|
|
|
|
return num
|
|
}
|
|
|
|
public static getUnLockDuiyouNum(){
|
|
let num = 0
|
|
let duiyouList = User.getDuiyouList()
|
|
for(let i = 0;i<duiyouList.length;i++){
|
|
if(duiyouList[i].isLock == false){
|
|
num++
|
|
}
|
|
}
|
|
|
|
return num
|
|
}
|
|
|
|
public static getIsLock(mishuId){
|
|
let isLock = true
|
|
let mishuList = User.getMishuList()
|
|
for(let i = 0;i<mishuList.length;i++){
|
|
if(mishuList[i].mishuId == mishuId){
|
|
isLock = mishuList[i].isLock
|
|
break
|
|
}
|
|
|
|
}
|
|
|
|
let duiyouList = User.getDuiyouList()
|
|
for(let i = 0;i<duiyouList.length;i++){
|
|
if(duiyouList[i].mishuId == mishuId){
|
|
isLock = duiyouList[i].isLock
|
|
break
|
|
}
|
|
}
|
|
|
|
return isLock
|
|
|
|
}
|
|
|
|
public static getMishuRedPoint(){
|
|
//可以解锁的
|
|
let isHaveRed = false
|
|
for(let i =0; i<configData.length; i++){
|
|
if(configData[i].mishuId != 16 && configData[i].mishuId != 17){
|
|
let needLock = MiShuManager.getMishuIsLockById(configData[i].mishuId)
|
|
if(needLock){
|
|
if(User.getMoney()-configData[i].lockMoney>=0){
|
|
isHaveRed = true
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(isHaveRed){
|
|
return isHaveRed
|
|
}
|
|
// let maxLevel = 100
|
|
// //可以升级的
|
|
// for(let i =0; i<configData.length; i++){
|
|
// let userDate = this.getMishuUserDateById(configData[i].mishuId)
|
|
// //let needLock = MiShuManager.getMishuIsLockById(configData[i].mishuId)
|
|
// if(userDate.isLock==false && userDate.mishuLevel<maxLevel){
|
|
|
|
// let spend = this.getlevelUpMoneyById(configData[i].mishuId)
|
|
// if(User.getMoney()-spend>=0){
|
|
// isHaveRed = true
|
|
// break
|
|
// }
|
|
|
|
// }
|
|
|
|
// }
|
|
return isHaveRed
|
|
}
|
|
|
|
|
|
public static getDuiyouRedPoint(){
|
|
//可以解锁的
|
|
let isHaveRed = false
|
|
for(let i =0; i<configData.length; i++){
|
|
if(configData[i].mishuId >= 18){
|
|
let needLock = MiShuManager.getMishuIsLockById(configData[i].mishuId)
|
|
if(needLock){
|
|
if(User.getMoney()-configData[i].lockMoney>=0){
|
|
isHaveRed = true
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(isHaveRed){
|
|
return isHaveRed
|
|
}
|
|
let maxLevel = 100
|
|
//可以升级的
|
|
for(let i =0; i<configData.length; i++){
|
|
if(configData[i].mishuId >= 18){
|
|
let userDate = this.getMishuUserDateById(configData[i].mishuId)
|
|
//let needLock = MiShuManager.getMishuIsLockById(configData[i].mishuId)
|
|
if(userDate.isLock==false && userDate.mishuLevel<maxLevel){
|
|
|
|
let spend = this.getlevelUpMoneyById(configData[i].mishuId)
|
|
if(User.getMoney()-spend>=0){
|
|
isHaveRed = true
|
|
break
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
return isHaveRed
|
|
}
|
|
|
|
|
|
public static getMishuLockIndex(){
|
|
let isHaveRed = false
|
|
let Index = 0
|
|
for(let i =0; i<configData.length; i++){
|
|
if(configData[i].mishuId < 18){
|
|
let needLock = MiShuManager.getMishuIsLockById(configData[i].mishuId)
|
|
if(needLock){
|
|
if(User.getMoney()-configData[i].lockMoney>=0){
|
|
isHaveRed = true
|
|
Index = i
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(isHaveRed){
|
|
return Index
|
|
}
|
|
let maxLevel = 100
|
|
//可以升级的
|
|
for(let i =0; i<configData.length; i++){
|
|
if( configData[i].mishuId < 18){
|
|
let userDate = this.getMishuUserDateById(configData[i].mishuId)
|
|
|
|
if(userDate.isLock ==false && userDate.mishuLevel<maxLevel){
|
|
|
|
let spend = this.getlevelUpMoneyById(configData[i].mishuId)
|
|
if(User.getMoney()-spend>=0){
|
|
isHaveRed = true
|
|
Index = i
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
return Index
|
|
}
|
|
|
|
public static getDuiyouLockIndex(){
|
|
let index = 0
|
|
let isHaveRed = false
|
|
for(let i =0; i<configData.length; i++){
|
|
if(configData[i].mishuId >= 18 && configData[i].mishuId!= 24){
|
|
let needLock = MiShuManager.getMishuIsLockById(configData[i].mishuId)
|
|
if(needLock){
|
|
if(User.getMoney()-configData[i].lockMoney>=0){
|
|
isHaveRed = true
|
|
index = i
|
|
break
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
if(isHaveRed){
|
|
return index
|
|
}
|
|
let maxLevel = 100
|
|
//可以升级的
|
|
for(let i =0; i<configData.length; i++){
|
|
if(configData[i].mishuId >= 18&& configData[i].mishuId!= 24){
|
|
let userDate = this.getMishuUserDateById(configData[i].mishuId)
|
|
//let needLock = MiShuManager.getMishuIsLockById(configData[i].mishuId)
|
|
if(userDate.isLock==false && userDate.mishuLevel<maxLevel){
|
|
|
|
let spend = this.getlevelUpMoneyById(configData[i].mishuId)
|
|
if(User.getMoney()-spend>=0){
|
|
isHaveRed = true
|
|
index = i
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
return index
|
|
}
|
|
|
|
}
|
|
|