觉醒时刻
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/MeiNvZhaoMu/MeiNvZhaoMuManager.ts

114 lines
3.6 KiB

1 week ago
import { ryw_Event } from "../../FrameWork/Event/EventEnum";
import EventMgr from "../../FrameWork/Event/EventMgr";
import User from "../../FrameWork/User/User";
import InterfaceManager from "../Manager/InterfaceManager";
const { ccclass, property } = cc._decorator;
// let AllConfig = [
// {id:0,maxTime:7200,buyPrice1:10000,buyPrice2:10000},
// {id:1,maxTime:7200,buyPrice1:10000,buyPrice2:10000},
// {id:2,maxTime:7200,buyPrice1:10000,buyPrice2:10000},
// {id:3,maxTime:7200,buyPrice1:10000,buyPrice2:10000},
// {id:4,maxTime:7200,buyPrice1:10000,buyPrice2:10000}
// ]
//0快递,1松花江,2下水道
export enum ZhaoMuGameType {
KuaiDi = 0,
SongHuaJiang,
XiaShuiDao
}
let beiShu = [2,3,4,5,6]
let AllConfig = [
[
{ id: 0, addTime: 3600, skinIndex: '1' },
{ id: 1, addTime: 3600, skinIndex: '2' },
{ id: 2, addTime: 3600, skinIndex: '3' },
{ id: 3, addTime: 3600, skinIndex: '4' },
{ id: 4, addTime: 3600, skinIndex: '5' },
],
[{ id: 0, addTime: 3600, skinIndex: '4' },
{ id: 1, addTime: 3600, skinIndex: '5' },
{ id: 2, addTime: 3600, skinIndex: '6' }],
[{ id: 0, addTime: 3600, skinIndex: '7' },
{ id: 1, addTime: 3600, skinIndex: '8' },
{ id: 2, addTime: 3600, skinIndex: '9' }]
]
@ccclass
export default class MeiNvZhaoMuManager {
public static initManager() {
// for(var i=0;i<AllConfig.length;i++){
// AllConfig[i].buyPrice1 = this.getPrice(0.2)
// AllConfig[i].buyPrice2 = this.getPrice(0.5)
// }
}
// public static getPrice(rate){
// let add = 500
// let earnMoney = InterfaceManager.getAllEarnMoneyInterface()
// let jinE = (add+earnMoney)*rate
// return jinE
// }
public static getAllConfig() {
return AllConfig
}
public static getConfigById(typeId, idIndex) {
// for(var i=0;i<AllConfig.length;i++){
// if(AllConfig[i].id == id){
return AllConfig[typeId][idIndex]
// }
// }
}
public static getMeiNvZhaoMuData() {
return User.getMeiNvZhaoMuData(AllConfig.length)
}
/**
*
* @param maxNum
* @param id
* @param unLockTab
* @param zhaoMuTime
* @param zhaoMuBeiShu
*/
public static setMeiNvZhaoMuData(id, addId) {
let tab = User.getMeiNvZhaoMuData(AllConfig.length)
let zhaoMuTime = tab[id].zhaoMuTime + AllConfig[id][addId].addTime
let unLockTab = tab[id].unLockTab
if (unLockTab.indexOf(addId) < 0) {
unLockTab.push(addId)
}
let zhaoMuBeiShu = 1
if (unLockTab.length >= 1) {
zhaoMuBeiShu = beiShu[unLockTab.length - 1]
}
User.setMeiNvZhaoMuData(AllConfig.length, id, unLockTab, zhaoMuTime, zhaoMuBeiShu)
EventMgr.emitEvent_custom(ryw_Event.refreshZhaoMuTimes);
}
public static updateAllZhaoMuTime() {
// let localZhaoMuData = this.getMeiNvZhaoMuData()
// for(var i=0;i<localZhaoMuData.length;i++){
// if(localZhaoMuData[i].isZhaoMuZhong){
// User.updateZhaoMuTime(i)
// }
// }
User.updateZhaoMuTime(AllConfig.length)
}
public static getZhaoMuBeiShu(typeId) {
let tab = User.getMeiNvZhaoMuData(AllConfig.length)
// for(var i=0;i<tab.length;i++){
// if(tab[i].isZhaoMuZhong){
// return 2
// }
// }
// return 1
return tab[typeId].zhaoMuBeiShu
}
public static getBeiShu() {
return beiShu
}
}