c1_lua/lua/app/ui/hero/cell/hero_cell.lua
2025-09-26 16:45:40 +08:00

22 lines
692 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.baseObject:setSprite(GConst.ATLAS_PATH.ICON_ITEM, GConst.FRAME_QLT[heroEntity:getQlt()])
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