Merge branch 'fang/dev' into dev
This commit is contained in:
commit
23bc8c3fae
@ -89,6 +89,7 @@ setmetatable(ModuleManager, MODULE_METATABLE)
|
||||
|
||||
function ModuleManager:init()
|
||||
ModuleManager.TaskManager:init()
|
||||
ModuleManager.DailyChallengeManager:init()
|
||||
end
|
||||
|
||||
-- 功能是否开启
|
||||
|
||||
@ -1,6 +1,14 @@
|
||||
local DailyChallengeManager = class("DailyChallengeManager", BaseModule)
|
||||
|
||||
function DailyChallengeManager:init()
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, function(idx)
|
||||
DataManager.DailyChallengeData:setShowingMainComp(idx == GConst.MainCityConst.BOTTOM_PAGE.MAIN)
|
||||
end)
|
||||
self:addEventListener(EventManager.CUSTOM_EVENT.UI_CLOSE, function(index)
|
||||
if index == UIManager.UI_PATH.MAINCITY_UI then
|
||||
DataManager.DailyChallengeData:setShowingMainComp(false)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function DailyChallengeManager:showBattleBuffUI()
|
||||
@ -20,9 +28,14 @@ function DailyChallengeManager:checkDayChange()
|
||||
if not DataManager.DailyChallengeData:getIfCanReset() then
|
||||
return
|
||||
end
|
||||
if not DataManager.DailyChallengeData:isShowingMainComp() then
|
||||
return
|
||||
end
|
||||
|
||||
-- 跨天了,请求新数据
|
||||
self:performWithDelayGlobal(function()
|
||||
self:onResetState()
|
||||
end, math.random())
|
||||
end
|
||||
|
||||
-- 开始挑战
|
||||
|
||||
@ -311,6 +311,10 @@ function MainCityUI:refreshBottom(selectedIndex, playAnim)
|
||||
self.selectedIndex = selectedIndex and selectedIndex or MAIN_COMP_INDEX
|
||||
self:switchComp()
|
||||
|
||||
if oldIndex ~= selectedIndex then
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, self.selectedIndex)
|
||||
end
|
||||
|
||||
-- 动效
|
||||
if playAnim and (oldIndex ~= selectedIndex) then
|
||||
local targetX = self.bottomBtnCells[self.selectedIndex]:getCurLocalPosX()
|
||||
|
||||
@ -318,4 +318,12 @@ function DailyChallengeData:getIfCanReset()
|
||||
return self.initDay < Time:getBeginningOfServerToday()
|
||||
end
|
||||
|
||||
function DailyChallengeData:setShowingMainComp(isShow)
|
||||
self.showing = isShow
|
||||
end
|
||||
|
||||
function DailyChallengeData:isShowingMainComp()
|
||||
return self.showing
|
||||
end
|
||||
|
||||
return DailyChallengeData
|
||||
Loading…
x
Reference in New Issue
Block a user