miduo_client/Assets/ManagedResources/~Lua/Modules/HomeLand/HomeLandManager.lua

45 lines
2.0 KiB
Lua

HomeLandManager = {}
local this = HomeLandManager
local HomeLand = ConfigManager.GetConfig(ConfigName.HomeLand)
local HomeLandLevel = ConfigManager.GetConfig(ConfigName.HomeLandLevel)
local HomeLandTask = ConfigManager.GetConfig(ConfigName.HomeLandTask)
function this.Initialize()
this.BuildData = {}
for _, configData in ConfigPairs(HomeLand) do
this.BuildData[configData.Id] = {}
this.BuildData[configData.Id].dataMain = configData--HomeLand中数据
if configData.LvupCostPool > 0 then
this.BuildData[configData.Id].level = 1 --等级
local singledata = ConfigManager.GetConfigDataByDoubleKey(ConfigName.HomeLandLevel,"PoolID",configData.Id,"level",this.BuildData[configData.Id].level)
this.BuildData[configData.Id].dataSingle = singledata--HomeLandLevel中数据
this.BuildData[configData.Id].startTime = 0 --资源开始积攒的时间
this.BuildData[configData.Id].endTime = 0 --建筑升级的结束时间
end
end
this.BuildData[6].level = 4
this.BuildData[5].level = 5
this.BuildData[6].startTime = 1640236645
end
--接收服务器信息
function this.GetServerData(msg,func)
if msg.infos then
LogGreen("长度:"..tostring(#msg.infos).." :"..tostring(LengthOfTable(#msg.infos)))
for key, value in pairs(msg.infos) do
local data = HomeLandLevel[value.id]
this.BuildData[data.PoolID].level = data.level
this.BuildData[data.PoolID].startTime = value.productionStartTime
this.BuildData[data.PoolID].endTime = value.upLvEndTime
this.BuildData[data.PoolID].dataSingle = HomeLandLevel[value.id]
LogGreen("Id:"..tostring(data.PoolID).." startTime:"..tostring(value.productionStartTime).." endTime:"..tostring(value.upLvEndTime))
end
end
if msg.drop then
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1)
end
if func then
func()
end
end
return HomeLandManager