32 lines
1.1 KiB
Lua
32 lines
1.1 KiB
Lua
local HeroCell = class("HeroCell", BaseCell)
|
|
|
|
function HeroCell:init()
|
|
local uiMap = self.baseObject:genAllChildren()
|
|
-- 通用
|
|
self.icon = uiMap["hero_cell.hero_bg.icon"]
|
|
self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
|
|
self.lvTx = uiMap["hero_cell.hero_bg.lv_tx"]
|
|
self.nameTx = uiMap["hero_cell.hero_bg.tx_name"]
|
|
self.starComp = uiMap["hero_cell.hero_bg.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
|
|
end
|
|
|
|
function HeroCell:refreshBriefInfo(heroEntity)
|
|
local id = heroEntity:getCfgId()
|
|
local level = heroEntity:getLv()
|
|
local star = heroEntity:getStar()
|
|
self.starComp:refresh(star)
|
|
|
|
local matchType = heroEntity:getMatchType()
|
|
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[matchType])
|
|
local avatarName = DataManager.PlayerData:getAvatarIconId(id)
|
|
self.icon:setSprite(GConst.ATLAS_PATH.ICON_AVATAR, avatarName)
|
|
self.nameTx:setText(ModuleManager.HeroManager:getHeroName(id))
|
|
self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.RUNES_DESC_26, level))
|
|
end
|
|
|
|
function HeroCell:setActive(active)
|
|
self.baseObject:setActive(active)
|
|
end
|
|
|
|
return HeroCell
|