更换皮肤卡面变化
This commit is contained in:
parent
52cab75d25
commit
aeb1c8e24a
@ -31,6 +31,9 @@ function HeroCell:init()
|
||||
self:bind(DataManager.BagData.ItemData, "dirty", function()
|
||||
self:refreshRedPoint()
|
||||
end)
|
||||
self:bind(DataManager.SkinData, "isDirty", function()
|
||||
self:refreshHeroIcon()
|
||||
end)
|
||||
end
|
||||
|
||||
function HeroCell:refresh(heroEntity, isGray)
|
||||
@ -92,6 +95,15 @@ function HeroCell:refresh(heroEntity, isGray)
|
||||
self:refreshRedPoint()
|
||||
end
|
||||
|
||||
-- 刷新英雄icon
|
||||
function HeroCell:refreshHeroIcon(iconName)
|
||||
if self.heroEntity ~= nil then
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO_2, DataManager.SkinData:getIcon(self.heroEntity:getSkinId()))
|
||||
elseif iconName then
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO_2, tostring(iconName))
|
||||
end
|
||||
end
|
||||
|
||||
-- 刷新红点
|
||||
function HeroCell:refreshRedPoint()
|
||||
if self.heroEntity == nil then
|
||||
@ -123,7 +135,10 @@ function HeroCell:getHeroId()
|
||||
return self.heroEntity:getCfgId()
|
||||
end
|
||||
|
||||
function HeroCell:refreshBriefInfo(id, level)
|
||||
function HeroCell:refreshBriefInfo(heroEntity)
|
||||
self.heroEntity = heroEntity
|
||||
local id = self.heroEntity:getCfgId()
|
||||
local level = self.heroEntity:getLv()
|
||||
self.selfNode:setVisible(false)
|
||||
self.otherNode:setVisible(true)
|
||||
|
||||
@ -165,10 +180,10 @@ function HeroCell:_refresh(heroInfo, isGray)
|
||||
self.heroBg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.FRAME_QLT[heroInfo.qlt])
|
||||
end
|
||||
self.heroDec:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HERO_DEC_QLT[heroInfo.qlt])
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO_2, tostring(heroInfo.icon))
|
||||
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroInfo.position])
|
||||
self.check:setVisible(false)
|
||||
self.sImg:setVisible(heroInfo.qlt >= 4)
|
||||
self:refreshHeroIcon(heroInfo.icon)
|
||||
self:setGray(isGray)
|
||||
end
|
||||
|
||||
|
||||
@ -59,7 +59,7 @@ function HeroFormationComp:refreshByEntitys(formation)
|
||||
local heroEntity = formation[i]
|
||||
if heroEntity then
|
||||
heroCell:setVisible(true, 1)
|
||||
heroCell:refreshBriefInfo(heroEntity:getCfgId(), heroEntity:getLv())
|
||||
heroCell:refreshBriefInfo(heroEntity)
|
||||
heroCell:addClickListener(function()
|
||||
ModuleManager.HeroManager:showHeroDetailUI(heroEntity:getCfgId(), true, heroEntity)
|
||||
end)
|
||||
|
||||
@ -133,6 +133,17 @@ function SkinData:getModelId(skinId)
|
||||
return cfg and cfg.model_id
|
||||
end
|
||||
|
||||
-- 获取icon名称
|
||||
function SkinData:getIcon(skinId)
|
||||
local cfg = self:getSkinCfg(skinId)
|
||||
if cfg and cfg.icon then
|
||||
return cfg.icon
|
||||
else
|
||||
local heroInfo = ConfigManager:getConfig("hero")[self:getHeroIdBySkinId(skinId)]
|
||||
return heroInfo.icon
|
||||
end
|
||||
end
|
||||
|
||||
-- 获取皮肤来源
|
||||
function SkinData:getSource(skinId)
|
||||
return I18N:getGlobalText("SKIN_GOT_" .. self:getSkinCfg(skinId).got)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user