2025-08-27 21:43:53 +08:00

28 lines
1.0 KiB
Lua

local TaskCell = class("TaskCell", BaseCell)
local ICON_BG = {"daily_challenge_bg_6", "daily_challenge_bg_5"}
-- local ICON = {"daily_task_1", "daily_task_2"}
function TaskCell:refresh(taskInfo, customProgress)
local complete = taskInfo.claimed
customProgress = customProgress or 0
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.bg"]:setSprite(GConst.ATLAS_PATH.DAILY_CHALLENGE, 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))
for i = 1, 3 do
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], complete, complete)
else
cell:setActive(false)
end
end
end
return TaskCell