This commit is contained in:
puxuan 2025-08-22 14:34:24 +08:00
parent 25b80d6f67
commit fdfe3a1d4f
2 changed files with 13 additions and 5 deletions

View File

@ -1,6 +1,6 @@
local TaskCell = class("TaskCell", BaseCell)
local ICON_BG = {"common_board_131", "common_board_132"}
local ICON_BG = {"act_common_bg_14", "act_common_bg_14"}
local ICON = {"daily_task_1", "daily_task_2"}
function TaskCell:refresh(taskInfo, customProgress)
@ -9,7 +9,7 @@ function TaskCell:refresh(taskInfo, customProgress)
local uiMap = self:getUIMap()
local cfg = DataManager.DailyChallengeData:getTaskCfg()[taskInfo.task_id]
local icon = complete and ICON_BG[2] or ICON_BG[1]
-- uiMap["task_cell.task_icon_bg"]:setSprite(GConst.ATLAS_PATH.COMMON, icon)
uiMap["task_cell.bg"]:setSprite(GConst.ATLAS_PATH.ACT_COMMON, icon)
-- icon = complete and ICON[2] or ICON[1]
-- uiMap["task_cell.task_icon"]:setSprite(GConst.ATLAS_PATH.DAILY_CHALLENGE, icon)
uiMap["task_cell.desc"]:setText(DataManager.DailyChallengeData:getTaskDesc(taskInfo.task_id, true, customProgress))
@ -18,7 +18,7 @@ function TaskCell:refresh(taskInfo, customProgress)
local cell = uiMap["task_cell.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
if cfg.reward[i] then
cell:setActive(true)
cell:refreshByConfig(cfg.reward[i])
cell:refreshByConfig(cfg.reward[i], complete, complete)
else
cell:setActive(false)
end

View File

@ -65,11 +65,13 @@ function TaskMainUI:onLoadRootComplete()
self.dailyTaskFinalCellProgressTx = uiMap["task_main_ui.bg.daily.task_final_cell.progress_tx"]
self.boxBtns = {}
self.boxBtnTxs = {}
self.boxBtnSpines = {}
local stageIds = DataManager.DailyTaskData:getStageIds()
for i = 1, 5 do
self.boxBtns[i] = uiMap["task_main_ui.bg.daily.task_final_cell.box_" .. i]
self.boxBtnTxs[i] = uiMap["task_main_ui.bg.daily.task_final_cell.box_" .. i .. ".text"]
self.boxBtnTxs[i]:setText(DataManager.DailyTaskData:getStageCondition(stageIds[i]))
self.boxBtnSpines[i] = uiMap["task_main_ui.bg.daily.task_final_cell.box_" .. i .. ".ui_spine_obj"]
-- self.boxBtns[i]:addClickListener(function()
-- GFunc.showToast(i)
-- -- local taskId = DataManager.DailyTaskData:getDailyTaskFinalId()
@ -166,11 +168,17 @@ function TaskMainUI:refreshDaily()
local stageId = stageIds[i]
if stageId then
item:setActive(true)
if DataManager.DailyTaskData:canClaimStage(stageId) then
if DataManager.DailyTaskData:isStageReceived(stageId) then
self.boxBtnSpines[i]:playAnim("idle02", true, false)
elseif DataManager.DailyTaskData:canClaimStage(stageId) then
self.boxBtnSpines[i]:playAnim("ready", true, false)
item:addClickListener(function()
self.boxBtnSpines[i]:playAnimComplete("open", false, true, function()
self:onClickBox()
end)
end)
else
self.boxBtnSpines[i]:playAnim("idle01", true, false)
item:addClickListener(function()
ModuleManager.TipsManager:showRewardsTips(DataManager.DailyTaskData:getStageReward(stageId), nil, item)
end)