local BountyRewardCell = class("BountyRewardCell", BaseCell) function BountyRewardCell:init() local uiMap = self:getUIMap() self.bg = uiMap["bounty_reward_cell.bg"] self.icon = uiMap["bounty_reward_cell.icon"] self.numTx = uiMap["bounty_reward_cell.num"] self.check = uiMap["bounty_reward_cell.check"] self.fragment = uiMap["bounty_reward_cell.fragment"] self.light = uiMap["bounty_reward_cell.light"] self.lock = uiMap["bounty_reward_cell.lock"] self:hideLight() self.baseObject:addClickListener(function() if self.clickCallback then self.clickCallback() elseif self.rewardId ~= nil then local desc = self:getRewardDesc(self.rewardId, self.rewardType) ModuleManager.TipsManager:showDescTips(desc, self.baseObject) end end) end function BountyRewardCell:refresh(reward, isPro, isLock, showCheck) self:showCheck(showCheck) if isPro then self.bg:setSprite(GConst.ATLAS_PATH.BOUNTY, "bounty_board_2") else self.bg:setSprite(GConst.ATLAS_PATH.BOUNTY, "bounty_board_1") end if isLock then self.lock:setVisible(true) else self.lock:setVisible(false) end if reward.type == GConst.REWARD_TYPE.ITEM then self:_refreshItem(reward) self.rewardId = reward.id self.rewardType = reward.type else self.rewardId = nil end end function BountyRewardCell:_refreshItem(item) local info = ConfigManager:getConfig("item")[item.id] if info == nil then return end self.numTx:setText(item.count or item.num) if info.type == GConst.ItemConst.ITEM_TYPE.HERO_FRAGMENT then local heroInfo = ConfigManager:getConfig("hero")[info.parameter] if heroInfo then self.icon:setLocalScale(0.86, 0.86, 0.86) self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, heroInfo.icon) else self.icon:setSprite(GConst.ATLAS_PATH.COMMON, "common_alpha") end self.fragment:setVisible(true) else self.icon:setLocalScale(1, 1, 1) self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon) self.fragment:setVisible(false) end end function BountyRewardCell:showCheck(show) self.check:setVisible(show == true) end function BountyRewardCell:setVisible(visible) self.baseObject:setActive(visible) end function BountyRewardCell:setAnchoredPositionX(x) self.baseObject:setAnchoredPositionX(x) end function BountyRewardCell:setTouchEnable(enable) self.baseObject:setTouchEnable(enable) end function BountyRewardCell:addClickListener(callback) self.clickCallback = callback end function BountyRewardCell:getRewardDesc(id, rewardType) if rewardType == GConst.REWARD_TYPE.ITEM then local item18NInfo = I18N:getConfig("item")[id] if item18NInfo then return item18NInfo.desc end end return GConst.EMPTY_STRING end function BountyRewardCell:showLight() self.light:setVisible(true) end function BountyRewardCell:hideLight() self.light:setVisible(false) end return BountyRewardCell