整理代码
This commit is contained in:
parent
4c27243520
commit
b36fde93c3
@ -41,6 +41,7 @@ end
|
|||||||
|
|
||||||
function FullMoonManager:rspActData(result)
|
function FullMoonManager:rspActData(result)
|
||||||
self.isReqActData = false
|
self.isReqActData = false
|
||||||
|
DataManager.FullMoonData:setInReset(false)
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
DataManager.FullMoonData:onGetActData(result.full_moon)
|
DataManager.FullMoonData:onGetActData(result.full_moon)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -63,11 +63,6 @@ function TaskManager:onResetDailyTask(result)
|
|||||||
DataManager.DailyTaskData:setInReset(false)
|
DataManager.DailyTaskData:setInReset(false)
|
||||||
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
if result.err_code == GConst.ERROR_STR.SUCCESS then
|
||||||
DataManager.DailyTaskData:init(result.info)
|
DataManager.DailyTaskData:init(result.info)
|
||||||
|
|
||||||
-- 检查圆月活动任务更新
|
|
||||||
if self:getIsInReset() then
|
|
||||||
ModuleManager.FullMoonManager:reqActData()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,12 @@ function FullMoonUI:onPressBackspace()
|
|||||||
self:closeUI()
|
self:closeUI()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function FullMoonUI:onClose()
|
||||||
|
if self.actCountdownSid then
|
||||||
|
self.txCountdown:unscheduleGlobal(self.actCountdownSid)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function FullMoonUI:ctor(param)
|
function FullMoonUI:ctor(param)
|
||||||
if param then
|
if param then
|
||||||
self.panelType = param
|
self.panelType = param
|
||||||
@ -92,6 +98,11 @@ function FullMoonUI:onLoadRootComplete()
|
|||||||
self:closeUI()
|
self:closeUI()
|
||||||
end)
|
end)
|
||||||
self:bind(DataManager.FullMoonData, "isDirty", function()
|
self:bind(DataManager.FullMoonData, "isDirty", function()
|
||||||
|
-- 检查更新数据
|
||||||
|
if DataManager.FullMoonData:getIsInReset() and self.panelType == GConst.FullMoonConst.PANEL_TYPE.TASK then
|
||||||
|
ModuleManager.FullMoonManager:reqActData()
|
||||||
|
end
|
||||||
|
|
||||||
self:onRefresh()
|
self:onRefresh()
|
||||||
end)
|
end)
|
||||||
self:bind(DataManager.ShopData, "isDirty", function()
|
self:bind(DataManager.ShopData, "isDirty", function()
|
||||||
@ -107,11 +118,6 @@ function FullMoonUI:onRefresh()
|
|||||||
self.txCountdown:setText(GFunc.getTimeStrWithHMS2(DataManager.FullMoonData:getEndRemainTime()))
|
self.txCountdown:setText(GFunc.getTimeStrWithHMS2(DataManager.FullMoonData:getEndRemainTime()))
|
||||||
self.actCountdownSid = self.txCountdown:scheduleGlobal(function()
|
self.actCountdownSid = self.txCountdown:scheduleGlobal(function()
|
||||||
self.txCountdown:setText(GFunc.getTimeStrWithHMS2(DataManager.FullMoonData:getEndRemainTime()))
|
self.txCountdown:setText(GFunc.getTimeStrWithHMS2(DataManager.FullMoonData:getEndRemainTime()))
|
||||||
|
|
||||||
-- 检查更新数据
|
|
||||||
if self:getIsInReset() and self.panelType == GConst.FullMoonConst.PANEL_TYPE.TASK then
|
|
||||||
ModuleManager.FullMoonManager:reqActData()
|
|
||||||
end
|
|
||||||
end, 1)
|
end, 1)
|
||||||
|
|
||||||
if self.panelType == GConst.FullMoonConst.PANEL_TYPE.TASK then
|
if self.panelType == GConst.FullMoonConst.PANEL_TYPE.TASK then
|
||||||
|
|||||||
@ -2,6 +2,12 @@ local FullMoonData = class("FullMoonData", BaseData)
|
|||||||
|
|
||||||
function FullMoonData:ctor()
|
function FullMoonData:ctor()
|
||||||
self.data.isDirty = false
|
self.data.isDirty = false
|
||||||
|
|
||||||
|
self.taskFinished = 0
|
||||||
|
self.curHeroGiftChoose = nil
|
||||||
|
self.taskStatus = GConst.EMPTY_TABLE
|
||||||
|
self.taskProgReward = GConst.EMPTY_TABLE
|
||||||
|
self.chapterSkinClaimed = GConst.EMPTY_TABLE
|
||||||
end
|
end
|
||||||
|
|
||||||
function FullMoonData:clear()
|
function FullMoonData:clear()
|
||||||
@ -28,9 +34,7 @@ function FullMoonData:onGetActData(data)
|
|||||||
self.taskFinished = data.finished or 0-- 任务奖励总计
|
self.taskFinished = data.finished or 0-- 任务奖励总计
|
||||||
self.taskStatus = data.tasks or GConst.EMPTY_TABLE
|
self.taskStatus = data.tasks or GConst.EMPTY_TABLE
|
||||||
self.taskProgReward = data.claimed or GConst.EMPTY_TABLE
|
self.taskProgReward = data.claimed or GConst.EMPTY_TABLE
|
||||||
-- self.curHeroGiftId = data.custom_gift_id
|
|
||||||
self.curHeroGiftChoose = data.custom_gift_choose
|
self.curHeroGiftChoose = data.custom_gift_choose
|
||||||
-- self.curNewHeroGiftId = data.hero_gift_id
|
|
||||||
self.chapterSkinClaimed = data.chapter_skin_claimed or GConst.EMPTY_TABLE
|
self.chapterSkinClaimed = data.chapter_skin_claimed or GConst.EMPTY_TABLE
|
||||||
|
|
||||||
if self:isOpenTime() then
|
if self:isOpenTime() then
|
||||||
@ -56,6 +60,7 @@ function FullMoonData:onGetActData(data)
|
|||||||
end
|
end
|
||||||
|
|
||||||
self:setInReset(true)
|
self:setInReset(true)
|
||||||
|
self:setDirty()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
self.isInitedData = true
|
self.isInitedData = true
|
||||||
@ -320,6 +325,7 @@ function FullMoonData:getTaskProgress(id)
|
|||||||
-- 玩家等级实时处理
|
-- 玩家等级实时处理
|
||||||
return DataManager.PlayerData:getLv()
|
return DataManager.PlayerData:getLv()
|
||||||
end
|
end
|
||||||
|
|
||||||
return self.taskStatus[id] and self.taskStatus[id].progress or 0
|
return self.taskStatus[id] and self.taskStatus[id].progress or 0
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -347,6 +353,11 @@ function FullMoonData:addTaskProgress(taskType, count)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- 检查圆月活动任务更新
|
||||||
|
if self:getIsInReset() then
|
||||||
|
ModuleManager.FullMoonManager:reqActData()
|
||||||
|
end
|
||||||
|
|
||||||
for id, data in pairs(self.taskStatus) do
|
for id, data in pairs(self.taskStatus) do
|
||||||
local tt = self:getTaskType(id)
|
local tt = self:getTaskType(id)
|
||||||
if tt == taskType then
|
if tt == taskType then
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user