diff --git a/lua/app/common/local_data.lua b/lua/app/common/local_data.lua index 616238b6..e64880d5 100644 --- a/lua/app/common/local_data.lua +++ b/lua/app/common/local_data.lua @@ -27,6 +27,7 @@ local LOCAL_DATA_KEY = { LAST_LOGIN_TIME = "LAST_LOGIN_TIME", GATE = "GATE", BOUNTY_POP_TIME = "BOUNTY_POP_TIME", + CHALLENGE_TASK_POP_TIME = "CHALLENGE_TASK_POP_TIME", } LocalData.KEYS = LOCAL_DATA_KEY @@ -345,4 +346,12 @@ function LocalData:getBountyPopTime() return self:getInt(LOCAL_DATA_KEY.BOUNTY_POP_TIME, 0) end +function LocalData:setChallengeTaskPopTime(time) + self:setInt(LOCAL_DATA_KEY.CHALLENGE_TASK_POP_TIME, time) +end + +function LocalData:getChallengeTaskPopTime() + return self:getInt(LOCAL_DATA_KEY.CHALLENGE_TASK_POP_TIME, 0) +end + return LocalData \ No newline at end of file diff --git a/lua/app/ui/daily_challenge/daily_challenge_task_ui.lua b/lua/app/ui/daily_challenge/daily_challenge_task_ui.lua index 2f6755d5..85adb485 100644 --- a/lua/app/ui/daily_challenge/daily_challenge_task_ui.lua +++ b/lua/app/ui/daily_challenge/daily_challenge_task_ui.lua @@ -34,6 +34,7 @@ function DailyChallengeTaskUI:ctor() end function DailyChallengeTaskUI:onLoadRootComplete() + DataManager.DailyChallengeData:markPopTask() self:_display() self:_addListeners() end diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua index 0b513e88..c0d561d8 100644 --- a/lua/app/ui/main_city/component/main_comp.lua +++ b/lua/app/ui/main_city/component/main_comp.lua @@ -35,6 +35,9 @@ function MainComp:refreshModule(selectModule) elseif self.curModuleType == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then -- 切换到每日挑战 EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_DAILY_CHALLENGE) + if DataManager.DailyChallengeData:getIsPopTask() then + ModuleManager.DailyChallengeManager:showBattleTaskUI() + end end end diff --git a/lua/app/userdata/daily_challenge/daily_challenge_data.lua b/lua/app/userdata/daily_challenge/daily_challenge_data.lua index b5ea5ad4..f64038be 100644 --- a/lua/app/userdata/daily_challenge/daily_challenge_data.lua +++ b/lua/app/userdata/daily_challenge/daily_challenge_data.lua @@ -23,6 +23,7 @@ function DailyChallengeData:init(data) self.totalFightCount = data.total_challenge_count or 0 self.todayFightCount = data.today_challenge_count or 0 self.initDay = Time:getBeginningOfServerToday() + self.popTaskTime = LocalData:getChallengeTaskPopTime() self:setDirty() end @@ -289,4 +290,19 @@ function DailyChallengeData:getIsInReset() return self.isInReset end +function DailyChallengeData:getIsPopTask() + if not self:isOpen() then + return false + end + return self.popTaskTime < Time:getBeginningOfServerToday() +end + +function DailyChallengeData:markPopTask() + if self.popTaskTime >= Time:getBeginningOfServerToday() then + return + end + self.popTaskTime = Time:getBeginningOfServerToday() + LocalData:setChallengeTaskPopTime(self.popTaskTime) +end + return DailyChallengeData \ No newline at end of file