奖励显示碎片
This commit is contained in:
parent
a44fb6ca2c
commit
f73980c7de
@ -7,6 +7,7 @@ function RewardCell:init()
|
|||||||
self.mask = uiMap["reward_cell.item_bg.mask"]
|
self.mask = uiMap["reward_cell.item_bg.mask"]
|
||||||
self.check = uiMap["reward_cell.check"]
|
self.check = uiMap["reward_cell.check"]
|
||||||
self.numTx = uiMap["reward_cell.item_bg.num"]
|
self.numTx = uiMap["reward_cell.item_bg.num"]
|
||||||
|
self.fragment = uiMap["reward_cell.item_bg.fragment"]
|
||||||
end
|
end
|
||||||
|
|
||||||
function RewardCell:refresh(reward)
|
function RewardCell:refresh(reward)
|
||||||
@ -15,11 +16,7 @@ function RewardCell:refresh(reward)
|
|||||||
if reward.type == GConst.REWARD_TYPE.ITEM then
|
if reward.type == GConst.REWARD_TYPE.ITEM then
|
||||||
self:_refreshItem(reward.item)
|
self:_refreshItem(reward.item)
|
||||||
id = reward.item.cfg_id or reward.item.id
|
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
|
end
|
||||||
|
|
||||||
if id then
|
if id then
|
||||||
self:addClickListener(function()
|
self:addClickListener(function()
|
||||||
ModuleManager.TipsManager:showRewardTips(id, reward.type, self.baseObject)
|
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
|
if reward.type == GConst.REWARD_TYPE.ITEM then
|
||||||
self:_refreshItem(reward)
|
self:_refreshItem(reward)
|
||||||
id = reward.id
|
id = reward.id
|
||||||
elseif reward.type == GConst.REWARD_TYPE.EQUIP then
|
|
||||||
-- self:_refreshEquip(reward)
|
|
||||||
-- id = reward.id
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if id then
|
if id then
|
||||||
@ -51,23 +45,23 @@ function RewardCell:_refreshItem(item)
|
|||||||
if info == nil then
|
if info == nil then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self.numTx:setVisible(true)
|
self.numTx:setVisible(true)
|
||||||
self.frameBg:setSprite(GConst.ATLAS_PATH.ICON_ITEM, "frame_0")
|
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)
|
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
|
end
|
||||||
|
self.fragment:setVisible(true)
|
||||||
function RewardCell:_refreshEquip(equip)
|
else
|
||||||
local info = ConfigManager:getConfig("equip")[equip.id]
|
self.icon:setLocalScale(1, 1, 1)
|
||||||
if info == nil then
|
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, info.icon)
|
||||||
return
|
self.fragment:setVisible(false)
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
function RewardCell:showNumTx(str)
|
function RewardCell:showNumTx(str)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user