c1_lua/lua/app/ui/hero/cell/star_info_cell.lua
2025-10-09 19:56:15 +08:00

39 lines
1.2 KiB
Lua

local StarCell = class("StarCell", BaseCell)
function StarCell:init()
local uiMap = self:getUIMap()
self.starBg = uiMap["cell.star_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.STAR_CELL)
self.descTx = uiMap["cell.desc_tx"]
self.lockImg = uiMap["cell.lock_img"]
-- self:addClickListener(function()
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SKIN_SELECT, self.skinId)
-- end)
end
function StarCell:refresh(heroEntity, idx)
self.heroEntity = heroEntity
if not self.heroEntity then
return
end
local star = self.heroEntity:getStar()
self.starBg:refresh(idx)
if idx <= star then
self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_7")
else
self.baseObject:setSprite(GConst.ATLAS_PATH.COMMON, "common_bg_8")
end
self.lockImg:setActive(idx > star)
local skillStr = ModuleManager.HeroManager:getHeroSkillDesc(self.heroEntity:getCfgId(), idx)
self.descTx:setText(skillStr)
-- local attr = heroEntity:getStarAttrCfg(idx)
-- local descTx = GFunc.getAttrDesc(attr.type, attr.num)
-- if not table.containValue(GConst.MATCH_ALL_ATKP_NAME, attr.type) then
-- descTx = heroEntity:getName() .. descTx
-- end
-- self.descTx:setText(descTx)
end
return StarCell