TreasureOfHeavenManger = {} local this = TreasureOfHeavenManger local ConfigData = ConfigManager.GetConfig(ConfigName.WorldBossTreasureConfig) this.curScore = 0--当前分数 this.resetTime = 0--倒计时 this.rewardStateData = {}--各个任务状态数据 -- local rewardData = {}--表内活动任务数据 this.TreasrueState = nil--礼包购买状态 function this.UpdateData(msg) -- rewardData = {} -- for i, v in ConfigPairs(ConfigData) do -- table.insert(rewardData, v) -- end if msg.score then this.curScore = msg.score end if msg.resetTime then this.resetTime = msg.resetTime end if msg.treasureRewardState then if #this.rewardStateData>0 then for i = 1, #this.rewardStateData do if this.rewardStateData[i].id == msg.treasureRewardState.id then this.rewardStateData[i].state = msg.treasureRewardState.state end end else this.rewardStateData = msg.treasureRewardState end end this.TreasrueState = msg.isBuy--OperatingManager.GetGoodsBuyTime(GoodsTypeDef.TreasureOfHeaven,106) end function this.SetTreasureState() this.TreasrueState = 1 return this.TreasrueState end function this.SetSingleRewardState(id,state) for i = 1, #this.rewardStateData do if(this.rewardStateData[i].id == id)then this.rewardStateData[i].state = state end end CheckRedPointStatus(RedPointType.Expedition_Treasure) end function this.GetAllRewardData() local data={} for i = 1, #this.rewardStateData do for k, v in ConfigPairs(ConfigData) do if this.rewardStateData[i].id == v.Id then table.insert(data, v) end end end return data end --红点检测 function this.RedPointState(singleRewardData,TreasrueState) if this.curScore >= ConfigData[singleRewardData.id].Integral then if singleRewardData.state==0 and this.TreasrueState==1 or singleRewardData.state==1 and this.TreasrueState==1 or singleRewardData.state==0 and this.TreasrueState==0 then return true end return false end return false end function this.RedPoint() for i =1, #this.rewardStateData do local curTreasrueState = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.TreasureOfHeaven,106) if this.curScore >= ConfigData[this.rewardStateData[i].id].Integral then if (this.rewardStateData[i].state==0 and curTreasrueState==1) or (this.rewardStateData[i].state==1 and curTreasrueState==1) or (this.rewardStateData[i].state==0 and curTreasrueState==0) then return true end end end return false end return this