c1_lua/lua/app/ui/hero/cell/hero_cell.lua
2025-08-18 18:12:22 +08:00

21 lines
597 B
Lua

local HeroCell = class("HeroCell", BaseCell)
function HeroCell:init()
local uiMap = self.baseObject:genAllChildren()
-- 通用
self.icon = uiMap["hero_cell.icon"]
self.matchImg = uiMap["hero_cell.match_img"]
end
function HeroCell:refresh(heroId)
local heroEntity = DataManager.HeroData:getHeroById(heroId)
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, heroEntity:getIcon())
self.matchImg:setSprite(GConst.ATLAS_PATH.ICON_HERO, GConst.HeroConst.MATCH_ICON_NAME[heroEntity:getMatchType()])
end
function HeroCell:setActive(active)
self.baseObject:setActive(active)
end
return HeroCell