bug修复

This commit is contained in:
xiekaidong 2023-09-05 10:47:55 +08:00
parent 9ce3168f39
commit b63a1e3ee0
3 changed files with 67 additions and 12 deletions

View File

@ -1,6 +1,10 @@
local FourteenDayManager = class("FourteenDayManager", BaseModule) local FourteenDayManager = class("FourteenDayManager", BaseModule)
function FourteenDayManager:showFourteenDayUI() function FourteenDayManager:showFourteenDayUI()
if DataManager.FourteenDayData:getNeedSyncData() then
self:reqSyncData()
end
local time = DataManager.FourteenDayData:getEndRemainTime() local time = DataManager.FourteenDayData:getEndRemainTime()
if time > 0 then if time > 0 then
UIManager:showUI("app/ui/activity/fourteen_day/fourteen_day_entrance_ui") UIManager:showUI("app/ui/activity/fourteen_day/fourteen_day_entrance_ui")
@ -56,4 +60,16 @@ function FourteenDayManager:rspExchangeReward(result)
end end
end end
function FourteenDayManager:reqSyncData()
self:sendMessage(ProtoMsgType.FromMsgEnum.FourteenDayInfoReq, {}, {}, self.rspSyncData)
end
function FourteenDayManager:rspSyncData(result)
if result.err_code == GConst.ERROR_STR.SUCCESS then
DataManager.FourteenDayData:setSyncData()
DataManager.FourteenDayData:initData(result.info)
DataManager.FourteenDayData:setDirty()
end
end
return FourteenDayManager return FourteenDayManager

View File

@ -111,6 +111,8 @@ local ProtoMsgType = {
[2285873970] = "ChapterBoxRewardRsp", [2285873970] = "ChapterBoxRewardRsp",
[2314118791] = "ChapterWeaponLatestPlayerInfoReq", [2314118791] = "ChapterWeaponLatestPlayerInfoReq",
[2314120624] = "ChapterWeaponLatestPlayerInfoRsp", [2314120624] = "ChapterWeaponLatestPlayerInfoRsp",
[2420360424] = "FourteenDayInfoReq",
[2420362257] = "FourteenDayInfoRsp",
[2429586383] = "MailCycleReq", [2429586383] = "MailCycleReq",
[2429588216] = "MailCycleRsp", [2429588216] = "MailCycleRsp",
[2467213182] = "ChapterWeaponChallengeFarmReq", [2467213182] = "ChapterWeaponChallengeFarmReq",
@ -356,6 +358,8 @@ local ProtoMsgType = {
ChapterBoxRewardRsp = 2285873970, ChapterBoxRewardRsp = 2285873970,
ChapterWeaponLatestPlayerInfoReq = 2314118791, ChapterWeaponLatestPlayerInfoReq = 2314118791,
ChapterWeaponLatestPlayerInfoRsp = 2314120624, ChapterWeaponLatestPlayerInfoRsp = 2314120624,
FourteenDayInfoReq = 2420360424,
FourteenDayInfoRsp = 2420362257,
MailCycleReq = 2429586383, MailCycleReq = 2429586383,
MailCycleRsp = 2429588216, MailCycleRsp = 2429588216,
ChapterWeaponChallengeFarmReq = 2467213182, ChapterWeaponChallengeFarmReq = 2467213182,
@ -601,6 +605,8 @@ local ProtoMsgType = {
ChapterBoxRewardRsp = "ChapterBoxRewardRsp", ChapterBoxRewardRsp = "ChapterBoxRewardRsp",
ChapterWeaponLatestPlayerInfoReq = "ChapterWeaponLatestPlayerInfoReq", ChapterWeaponLatestPlayerInfoReq = "ChapterWeaponLatestPlayerInfoReq",
ChapterWeaponLatestPlayerInfoRsp = "ChapterWeaponLatestPlayerInfoRsp", ChapterWeaponLatestPlayerInfoRsp = "ChapterWeaponLatestPlayerInfoRsp",
FourteenDayInfoReq = "FourteenDayInfoReq",
FourteenDayInfoRsp = "FourteenDayInfoRsp",
MailCycleReq = "MailCycleReq", MailCycleReq = "MailCycleReq",
MailCycleRsp = "MailCycleRsp", MailCycleRsp = "MailCycleRsp",
ChapterWeaponChallengeFarmReq = "ChapterWeaponChallengeFarmReq", ChapterWeaponChallengeFarmReq = "ChapterWeaponChallengeFarmReq",

View File

@ -25,12 +25,7 @@ function FourteenDayData:init(data)
Logger.logHighlight("新手14天乐数据初始化") Logger.logHighlight("新手14天乐数据初始化")
Logger.printTable(data) Logger.printTable(data)
end end
self:initData(data)
self.openTs = GFunc.formatTimeStep(data.open_at or 0)
self.activeDays = data.active_days or 0-- 活动开启后的登陆天数、阶段数
self.bountyStatus = data.funds
self.tasksStatus = data.tasks
self.exchangeStatus = data.exchange_info
-- 活动开启 -- 活动开启
DataManager:registerTryOpenFunc("FourteenDayData", function() DataManager:registerTryOpenFunc("FourteenDayData", function()
@ -47,11 +42,21 @@ function FourteenDayData:init(data)
if not self:isActiveTime() then if not self:isActiveTime() then
return return
end end
if not self.openStatus then
self.needSyncTaskInfo = true
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_SIDE_BAR)
end
self.openStatus = true
-- Logger.logHighlight("14天乐跨天") -- Logger.logHighlight("14天乐跨天")
self.activeDays = self.activeDays + 1 self.activeDays = self.activeDays + 1
self:setDirty() self:setDirty()
end) end)
local endTime = self:getEndTime()
local nowTime = Time:getServerTime()
if endTime > nowTime then
-- 注册任务进度监听 -- 注册任务进度监听
for id, data in ipairs(self:getTaskCfg()) do for id, data in ipairs(self:getTaskCfg()) do
if data.quest then if data.quest then
@ -60,6 +65,28 @@ function FourteenDayData:init(data)
end) end)
end end
end end
end
self.openStatus = false
if self:isOpen() and self:isActiveTime() then
self.openStatus = true
end
end
function FourteenDayData:initData(data)
self.openTs = GFunc.formatTimeStep(data.open_at or 0)
self.activeDays = data.active_days or 0-- 活动开启后的登陆天数、阶段数
self.bountyStatus = data.funds
self.tasksStatus = data.tasks
self.exchangeStatus = data.exchange_info
end
function FourteenDayData:getNeedSyncData()
return self.needSyncTaskInfo
end
function FourteenDayData:setSyncData()
self.needSyncTaskInfo = true
end end
function FourteenDayData:isOpen() function FourteenDayData:isOpen()
@ -395,6 +422,12 @@ end
-- 添加任务进度 -- 添加任务进度
function FourteenDayData:addTaskProgress(taskType, count) function FourteenDayData:addTaskProgress(taskType, count)
-- Logger.logHighlight("任务进度改变:"..tostring(taskType)..","..tostring(count)) -- Logger.logHighlight("任务进度改变:"..tostring(taskType)..","..tostring(count))
if not self:isOpen() then
return
end
if not self:isActiveTime() then
return
end
for id, data in ipairs(self:getTaskCfg()) do for id, data in ipairs(self:getTaskCfg()) do
if data.quest == taskType then if data.quest == taskType then