c1_lua/lua/app/ui/hero/cell/attr_node_cell.lua
2023-07-20 10:15:42 +08:00

32 lines
1.3 KiB
Lua

local AttrNodeCell = class("AttrNodeCell", BaseCell)
local ATTR_CELL = "app/ui/hero/cell/attr_cell"
local ATTR_CELL_PATH = "assets/prefabs/ui/hero/cell/attr_cell.prefab"
function AttrNodeCell:init()
local uiMap = self:getUIMap()
self.txTitle = uiMap["total_node.tx_title"]
self.itemsRoot = uiMap["total_node.items"]
end
function AttrNodeCell:refresh(heroId, node)
if node == GConst.HeroConst.ATTR_SHOW_TOTAL then
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_13))
elseif node == GConst.HeroConst.ATTR_SHOW_BASE then
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_14))
elseif node == GConst.HeroConst.ATTR_SHOW_WEAPON then
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_15))
elseif node == GConst.HeroConst.ATTR_SHOW_ARMOR then
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_16))
elseif node == GConst.HeroConst.ATTR_SHOW_SKIN then
self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.EQUIP_DESC_17))
end
for index, attr in ipairs(node) do
CellManager:loadCellAsync(ATTR_CELL_PATH, ATTR_CELL, self.itemsRoot, function(cell)
cell:refresh(heroId, node, attr)
end)
end
end
return AttrNodeCell