1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- /** @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<string, IRewardNty> = new Map()
- globalTime: number = 0
- secondTime: number = 0
- @observable
- minutesTime: number = 0
- @observable
- //服务器时间 单位:秒
- serverTime: number = 0
- //登录时间
- loginTime: number = 0
- buildData: building[]
- roleSpineMap: Map<string, sp.SkeletonData> = new Map()
- itemsPrefabMap: Map<string, cc.Prefab> = new Map()
- itemsPoolMap: Map<string, cc.NodePool> = 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<number, activityTimeInfo> = new Map() //活动列表
- modPopMap: Map<number, boolean> = new Map()
- //模块红点数据
- modRedMap: Map<number, boolean> = 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
- 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,
- ]
- }
- reset() {
- this.modRedMap.clear()
- this.emailRed = false
- this.curServer = null
- this.serverList = []
- }
- }
|