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