From f73980c7de08551a2f203931de7a237ea3a12931 Mon Sep 17 00:00:00 2001 From: chenxi Date: Thu, 20 Apr 2023 17:40:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=96=E5=8A=B1=E6=98=BE=E7=A4=BA=E7=A2=8E?= =?UTF-8?q?=E7=89=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/common/cell/reward_cell.lua | 34 +++++++++++--------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/lua/app/ui/common/cell/reward_cell.lua b/lua/app/ui/common/cell/reward_cell.lua index d0315875..0d939419 100644 --- a/lua/app/ui/common/cell/reward_cell.lua +++ b/lua/app/ui/common/cell/reward_cell.lua @@ -7,6 +7,7 @@ function RewardCell:init() self.mask = uiMap["reward_cell.item_bg.mask"] self.check = uiMap["reward_cell.check"] self.numTx = uiMap["reward_cell.item_bg.num"] + self.fragment = uiMap["reward_cell.item_bg.fragment"] end function RewardCell:refresh(reward) @@ -15,11 +16,7 @@ function RewardCell:refresh(reward) if reward.type == GConst.REWARD_TYPE.ITEM then self:_refreshItem(reward.item) id = reward.item.cfg_id or reward.item.id - -- elseif reward.type == GConst.REWARD_TYPE.EQUIP then - -- self:_refreshEquip(reward.equip) - -- id = reward.equip.id end - if id then self:addClickListener(function() ModuleManager.TipsManager:showRewardTips(id, reward.type, self.baseObject) @@ -34,9 +31,6 @@ function RewardCell:refreshByConfig(reward, mask, check) if reward.type == GConst.REWARD_TYPE.ITEM then self:_refreshItem(reward) id = reward.id - elseif reward.type == GConst.REWARD_TYPE.EQUIP then - -- self:_refreshEquip(reward) - -- id = reward.id end if id then @@ -51,23 +45,23 @@ function RewardCell:_refreshItem(item) if info == nil then return end - self.numTx:setVisible(true) self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_0") - self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon) self.numTx:setText(item.count or item.num) -end - -function RewardCell:_refreshEquip(equip) - local info = ConfigManager:getConfig("equip")[equip.id] - if info == nil then - return + 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 - - self.numTx:setVisible(true) - self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, "frame_" .. info.qlt) - self.icon:setSprite(GConst.ATLAS_PATH.ICON_EQUIP, tostring(info.icon)) - self.numTx:setText(equip.count) end function RewardCell:showNumTx(str)