觉醒时刻
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/Manager/ChouShuiDataManager.ts

110 lines
3.3 KiB

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 TaskManager, { MainTaskIdEnum } from "../../Scripts/JuQingChat/TaskManager"
export enum ShuiTangType {
jialebihai,
TaiPingYang,
sihai,
ShuiChi,
dongtinghu,
shanhuhai,
jiaoshihai,
csg,
}
export default class ChouShuiDataManager {
public static ShuiChiConfig = [
{ type: ShuiTangType.jialebihai, nameStr: '甲鱼塘', sprUrl: '加勒比海', isChoushui: false },
{ type: ShuiTangType.TaiPingYang, nameStr: '潘阳湖', sprUrl: '太平洋', isChoushui: false },
{ type: ShuiTangType.sihai, nameStr: '水库', sprUrl: '死海', isChoushui: false },
{ type: ShuiTangType.ShuiChi, nameStr: '水池', sprUrl: '水池', isChoushui: false },
{ type: ShuiTangType.dongtinghu, nameStr: '洞庭湖', sprUrl: '洞庭湖', isChoushui: false },
{ type: ShuiTangType.shanhuhai, nameStr: '梅溪湖', sprUrl: '珊瑚海', isChoushui: false },
{ type: ShuiTangType.jiaoshihai, nameStr: '钓鱼场', sprUrl: '礁石海', isChoushui: false },
{ type: ShuiTangType.csg, nameStr: '臭水沟', sprUrl: '臭水沟', isChoushui: false },
]
static isAD: boolean = false
//随机出需要显示的水坑
public static getRandomShuiChiArr() {
let temp = Common5.getNumberFromArray(0, 8, 3)
console.log('随机数据==', temp)
let arr = []
for (let i = 0; i < temp.length; i++) {
let data = this.ShuiChiConfig[temp[i]]
data.isChoushui = false
arr.push(data)
}
let mainTaskInfo: any = TaskManager.getCurUnLockMainTaskInfo()
let mainId = mainTaskInfo.Id
// if (mainId == MainTaskIdEnum.MainTask_509) {
// let isHave = ChouShuiDataManager.getShuiKengConfig(arr, ShuiTangType.jiaoshihai)
// if (!isHave) {
// let dataTemp = this.ShuiChiConfig[6]
// dataTemp.isChoushui = false
// let randIndex = Common5.getRandomNum(0, arr.length)
// arr[randIndex] = dataTemp
// }
// }
console.log('随机出的水池config==', arr)
return arr;
}
//获取显示水坑
public static getShowWater() {
let tab = User.getCurDayWaterArr()
if (tab.length <= 0) {
tab = this.getRandomShuiChiArr()
User.setCurDayWaterArr(tab);
}
return tab;
}
//获取水坑信息
public static getShuiKengConfig(arr, type) {
for (let i = 0; i < arr.length; i++) {
if (arr[i].type == type) {
return true
}
}
return false
}
//获取水坑信息
public static getShuiKengInfo() {
}
public static clearAllRecord() {
User.setCurDayWaterArr([])
}
public static changeChoushuiState(index) {
let tab = User.getCurDayWaterArr()
tab[index].isChoushui = true
EventMgr.emitEvent_custom(ryw_Event.refreshChoushui, index)
}
public static getIsAD() {
return this.isAD
}
public static setIsAD(isAD: boolean) {
this.isAD = isAD
}
}