From 827c282c62a8f497314e4816bc7bfcdfd7033172 Mon Sep 17 00:00:00 2001 From: Fang Date: Mon, 5 Jun 2023 10:41:10 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A6=96=E6=AC=A1=E8=BF=9B=E5=85=A5=E6=AF=8F?= =?UTF-8?q?=E6=97=A5=E6=8C=91=E6=88=98=E6=9C=AA=E6=98=BE=E7=A4=BA=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E5=BC=B9=E7=AA=97fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/common/local_data.lua | 9 +++++++++ .../daily_challenge/daily_challenge_task_ui.lua | 1 + lua/app/ui/main_city/component/main_comp.lua | 3 +++ .../daily_challenge/daily_challenge_data.lua | 16 ++++++++++++++++ 4 files changed, 29 insertions(+) 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