61 lines
2.2 KiB
Lua
61 lines
2.2 KiB
Lua
GeneralTreasureMangaer = {}
|
|
local this = GeneralTreasureMangaer
|
|
|
|
function this.Initialize()
|
|
this.TreasureList = {
|
|
[ActivityTypeDef.QiJieTreasure] = {ActId = 0,endTime = 0,dataList = {},configName = ConfigName.QijieTreasure},
|
|
}
|
|
this.InitConfigData()
|
|
end
|
|
|
|
function this.InitConfigData()
|
|
for k,v in pairs(this.TreasureList) do
|
|
for _, configInfo in ConfigPairs(ConfigManager.GetConfig(v.configName)) do
|
|
if configInfo.Id then
|
|
local data = {}
|
|
data.Id = configInfo.Id
|
|
data.Level = configInfo.Level
|
|
data.Integral = configInfo.Integral
|
|
data.Reward = configInfo.Reward
|
|
data.TreasureReward = configInfo.TreasureReward
|
|
data.State = -1
|
|
data.Progress = -1
|
|
v.dataList[data.Id] = data
|
|
end
|
|
end
|
|
table.sort(v.dataList,function (a,b)
|
|
return a.Id < b.Id
|
|
end)
|
|
end
|
|
end
|
|
|
|
function this.GetTreasureData(ActType)
|
|
local actInfo = ActivityGiftManager.GetActivityTypeInfo(ActType)
|
|
local curTypeData = this.TreasureList[ActType]
|
|
curTypeData.ActId = actInfo.activityId
|
|
curTypeData.endTime = actInfo.endTime
|
|
curTypeData.treasureState = actInfo.value
|
|
-- curTypeData.treasureState = actInfo.treasureState
|
|
--4 未达成 3 可再次领取 2 可领取 1 已领取 -1 完美领取(充钱领取过的)
|
|
for k,v in pairs(actInfo.mission) do
|
|
if v.state == 0 then
|
|
if curTypeData.dataList[v.missionId].Integral <= v.progress then
|
|
curTypeData.dataList[v.missionId].State = 2--未领取
|
|
else
|
|
curTypeData.dataList[v.missionId].State = 4--未达成
|
|
end
|
|
elseif v.state == 1 then
|
|
if actInfo.value == 0 then
|
|
curTypeData.dataList[v.missionId].State = 1--不完美领取但不能领
|
|
else
|
|
curTypeData.dataList[v.missionId].State = 3--不完美领取可继续领
|
|
end
|
|
elseif v.state == -1 then
|
|
curTypeData.dataList[v.missionId].State = -1--完美领取
|
|
end
|
|
curTypeData.dataList[v.missionId].Progress = v.progress
|
|
end
|
|
return curTypeData
|
|
end
|
|
|
|
return GeneralTreasureMangaer |