miduo_client/Assets/ManagedResources/~Lua/Modules/TreasureOfHeaven/TreasureOfHeavenManager.lua

91 lines
2.4 KiB
Lua
Raw Normal View History

2020-08-25 15:46:38 +08:00
TreasureOfHeavenManger = {}
2020-06-03 19:09:01 +08:00
local this = TreasureOfHeavenManger
local WorldBossTreasureConfig = ConfigManager.GetConfig(ConfigName.WorldBossTreasureConfig)
local curScore--当前分数
2020-06-30 18:59:44 +08:00
local limitTime--倒计时
2020-06-03 19:09:01 +08:00
local rewardStateData = {}--各个任务状态数据
local rewardData = {}--表内活动任务数据
2020-07-24 18:30:26 +08:00
this.TreasrueState = nil--礼包购买状态
2020-06-03 19:09:01 +08:00
function this.Initialize()
rewardData = {}
for i, v in ConfigPairs(WorldBossTreasureConfig) do
table.insert(rewardData, v)
end
end
function this.GetTreasureState()
2020-07-24 18:30:26 +08:00
this.TreasrueState = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.TreasureOfHeaven,106)
return this.TreasrueState
2020-06-03 19:09:01 +08:00
end
function this.SetTreasureState()
2020-07-24 18:30:26 +08:00
this.TreasrueState = 1
return this.TreasrueState
2020-06-03 19:09:01 +08:00
end
function this.SetScore(score)
curScore = score
end
function this.GetScore()
return curScore
end
2020-06-30 18:59:44 +08:00
function this.SetLimitTime(time)
limitTime = time
end
function this.GetLimitTime()
return limitTime
end
2020-06-03 19:09:01 +08:00
function this.SetState(treasureRewardState)
rewardStateData = {}
for i, v in ipairs(treasureRewardState) do
table.insert(rewardStateData, v)
end
end
function this.GetState()
return rewardStateData
end
function this.SetSingleRewardState(id,state)
for i = 1, #rewardStateData do
if(rewardStateData[i].id == id)then
rewardStateData[i].state = state
end
end
CheckRedPointStatus(RedPointType.Expedition_Treasure)
end
function this.GetAllRewardData()
return rewardData
end
--红点检测
2020-07-24 18:30:26 +08:00
function this.RedPointState(singleRewardData,TreasrueState)
2020-06-03 19:09:01 +08:00
if curScore >= rewardData[singleRewardData.id].Integral then
2020-07-24 18:30:26 +08:00
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
2020-06-03 19:09:01 +08:00
return true
end
return false
end
return false
end
function this.RedPoint()
for i =1, #rewardStateData do
2020-07-24 18:30:26 +08:00
local curTreasrueState = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.TreasureOfHeaven,106)
2020-06-03 19:09:01 +08:00
if curScore >= rewardData[rewardStateData[i].id].Integral then
2020-07-24 18:30:26 +08:00
if rewardStateData[i].state==0 and curTreasrueState==1 or
rewardStateData[i].state==1 and curTreasrueState==1 or
rewardStateData[i].state==0 and curTreasrueState==0 then
2020-06-03 19:09:01 +08:00
return true
end
end
end
return false
end
2020-07-25 20:42:11 +08:00
return this