/** @format */ import {observable, computed, action} from 'mobx' import {activityTimeInfo, building, idNum, popGiftInfo} from '../proto/typedef' import {Data, Mgr} from '../GameControl' import {DataConfig} from '../config/DataConfig' import {RoleLevelConfig} from '../config/RoleLevelConfig' import {RoleQualityConfig} from '../config/RoleQualityConfig' import {IBaseAttr, IServer, ITimeGift} from '../interface/GlobalInterface' import {CHANNEL, DIS_ID, LOGIN_TYPE, MOD} from '../enums/Enum' import {IOnlineRewardData, IRewardNty} from '../interface/UIInterface' import {onlineAwardNty, rechargeResult, relicDataNty} from '../proto/game' export class MainData { @observable webSocketCon: boolean = false texBundle: cc.AssetManager.Bundle //服务器道具更新消息缓存 rewardNtyMap: Map = new Map() globalTime: number = 0 secondTime: number = 0 @observable minutesTime: number = 0 @observable //服务器时间 单位:秒 serverTime: number = 0 //登录时间 loginTime: number = 0 buildData: building[] roleSpineMap: Map = new Map() itemsPrefabMap: Map = new Map() itemsPoolMap: Map = new Map() maxRoleQuality: number = DataConfig[DIS_ID.heroQuality].data1 maxCardQuality: number = DataConfig[DIS_ID.heroQuality].data2 maxEquipQuality: number = DataConfig[DIS_ID.heroQuality].data3 maxRoleLv: number = 0 maxCardLv: number = 0 maxEquipLv: number = 0 //一个角色最多携带的装备数量 equipMaxNum: number = 6 //天赋加成是基础值 talentAdd: IBaseAttr[] safeTop: number = 0 timeGifts: ITimeGift[] = [] //遗迹加成是比例值 relicAdd: IBaseAttr[] relicData: relicDataNty activityList: Map = new Map() //活动列表 modPopMap: Map = new Map() //模块红点数据 modRedMap: Map = new Map() @observable emailRed: boolean = false loginType: LOGIN_TYPE //战斗后返回 exitGame: boolean = false 战斗后返回升级 exitGameLv: boolean = false localVersion: string = '' //是否是第二天登录 isSecondDay: boolean = false appType: string = '' payData: rechargeResult[] = [] channel: CHANNEL onlineRewards: onlineAwardNty //在线奖励数据 onlineGetRewards: IOnlineRewardData[] = [] //在线奖励领取阶段--阶段时间数组 curServer: IServer serverList: IServer[] init() { this.maxRoleLv = RoleQualityConfig[this.maxRoleQuality].maxLv this.maxCardLv = RoleQualityConfig[this.maxCardQuality].maxLv //在线奖励一到六档 let rewardList = [ DIS_ID.onlineIdx1, DIS_ID.onlineIdx2, DIS_ID.onlineIdx3, DIS_ID.onlineIdx4, DIS_ID.onlineIdx5, DIS_ID.onlineIdx6, ] Data.main.onlineGetRewards = [] for (let i = 0; i < rewardList.length; i++) { let item = DataConfig[rewardList[i]] Data.main.onlineGetRewards.push({ idx: rewardList[i], time: item.data1, data: {id: item.data2, num: item.data3}, }) } } reset() { this.modRedMap.clear() this.emailRed = false this.curServer = null this.serverList = [] } }