25 lines
749 B
Lua
25 lines
749 B
Lua
local TargetCell = class("TargetCell", BaseCell)
|
|
|
|
function TargetCell:refresh(parentUI, dataKey, cfg, func)
|
|
local data = DataManager[dataKey]
|
|
|
|
local uiMap = self:getUIMap()
|
|
if not self.rewardCell then
|
|
self.rewardCell = CellManager:addCellComp(uiMap["target_cell.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
|
end
|
|
|
|
local reward = cfg.reward[1]
|
|
local got = data:getGameScoreRewardGot(cfg.id)
|
|
local canget = data:getGameScoreRewardCanGet(cfg.id)
|
|
|
|
self.rewardCell:refreshByConfig(reward, got, got)
|
|
if canget then
|
|
self.rewardCell:showFrameAnimation()
|
|
self.rewardCell:addClickListener(func)
|
|
else
|
|
self.rewardCell:hideFrameAnimation()
|
|
end
|
|
uiMap["target_cell.tx_idx"]:setText(cfg.point)
|
|
end
|
|
|
|
return TargetCell |