战令
This commit is contained in:
parent
f7cd1c6094
commit
b9023a0a39
@ -7,6 +7,7 @@ end
|
|||||||
function BountyMainUI:ctor()
|
function BountyMainUI:ctor()
|
||||||
self.maxCellIdx = 0
|
self.maxCellIdx = 0
|
||||||
self.maxCellNum = 0
|
self.maxCellNum = 0
|
||||||
|
self.endTime = DataManager.BountyData:getEndTime()
|
||||||
-- 默认预览第10档奖励
|
-- 默认预览第10档奖励
|
||||||
self.previewRewardIndex = 10
|
self.previewRewardIndex = 10
|
||||||
end
|
end
|
||||||
@ -304,7 +305,7 @@ function BountyMainUI:scrollToIndex(targetIndex)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BountyMainUI:updateTime()
|
function BountyMainUI:updateTime()
|
||||||
local remainTime = DataManager.BountyData:getRemainTime()
|
local remainTime = self.endTime - Time:getServerTime()
|
||||||
if remainTime < 0 then
|
if remainTime < 0 then
|
||||||
UIManager:closeUnderUI(self)
|
UIManager:closeUnderUI(self)
|
||||||
return self:closeUI()
|
return self:closeUI()
|
||||||
|
|||||||
@ -7,6 +7,10 @@ function BountyData:ctor()
|
|||||||
self.data.dirty = false
|
self.data.dirty = false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BountyData:clear()
|
||||||
|
DataManager:unregisterCrossDayFunc("BountyData")
|
||||||
|
end
|
||||||
|
|
||||||
function BountyData:init(data)
|
function BountyData:init(data)
|
||||||
data = data or GConst.EMPTY_TABLE
|
data = data or GConst.EMPTY_TABLE
|
||||||
self.season = data.season or 1
|
self.season = data.season or 1
|
||||||
@ -18,6 +22,10 @@ function BountyData:init(data)
|
|||||||
self.endTime = 0
|
self.endTime = 0
|
||||||
self:initBountyTime()
|
self:initBountyTime()
|
||||||
self:initBountyLevelCfg()
|
self:initBountyLevelCfg()
|
||||||
|
DataManager:registerCrossDayFunc("BountyData", function()
|
||||||
|
self:checkNextSeason()
|
||||||
|
self:markDirty()
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function BountyData:initBountyTime()
|
function BountyData:initBountyTime()
|
||||||
@ -30,7 +38,13 @@ function BountyData:initBountyTime()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BountyData:initBountyLevelCfg()
|
function BountyData:initBountyLevelCfg()
|
||||||
self.bountyLevelCfg = {}
|
if self.bountyLevelCfg == nil then
|
||||||
|
self.bountyLevelCfg = {}
|
||||||
|
else
|
||||||
|
for i = 1, #self.bountyLevelCfg do
|
||||||
|
table.remove(self.bountyLevelCfg)
|
||||||
|
end
|
||||||
|
end
|
||||||
local cfg = ConfigManager:getConfig("bounty_level")
|
local cfg = ConfigManager:getConfig("bounty_level")
|
||||||
for k, v in pairs(cfg) do
|
for k, v in pairs(cfg) do
|
||||||
if v.season == self.season then
|
if v.season == self.season then
|
||||||
@ -40,6 +54,30 @@ function BountyData:initBountyLevelCfg()
|
|||||||
self.repeatLevelInfo = table.remove(self.bountyLevelCfg)
|
self.repeatLevelInfo = table.remove(self.bountyLevelCfg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BountyData:checkNextSeason()
|
||||||
|
if self.endTime > Time:getServerTime() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local nextSeason = self.season + 1
|
||||||
|
local info = ConfigManager:getConfig("bounty_time")[nextSeason]
|
||||||
|
if info == nil then
|
||||||
|
self.endTime = 0
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.endTime = Time:getCertainTimeByStr(info.end_time)
|
||||||
|
self.season = nextSeason
|
||||||
|
self.level = 1
|
||||||
|
self.exp = 0
|
||||||
|
self.bought = false
|
||||||
|
for k, v in pairs(self.claimed) do
|
||||||
|
self.claimed[k] = false
|
||||||
|
end
|
||||||
|
for k, v in pairs(self.proClaimed) do
|
||||||
|
self.proClaimed[k] = false
|
||||||
|
end
|
||||||
|
self:initBountyLevelCfg()
|
||||||
|
end
|
||||||
|
|
||||||
function BountyData:getBought()
|
function BountyData:getBought()
|
||||||
return self.bought
|
return self.bought
|
||||||
end
|
end
|
||||||
@ -157,9 +195,8 @@ function BountyData:markDirty()
|
|||||||
self.data.dirty = not self.data.dirty
|
self.data.dirty = not self.data.dirty
|
||||||
end
|
end
|
||||||
|
|
||||||
function BountyData:getRemainTime()
|
function BountyData:getEndTime()
|
||||||
local nowTime = Time:getServerTime()
|
return self.endTime
|
||||||
return self.endTime - nowTime
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function BountyData:getExpItemIcon()
|
function BountyData:getExpItemIcon()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user