c1_lua/lua/app/ui/hero/hero_attr_all_ui.lua
2025-10-17 20:37:11 +08:00

45 lines
1.5 KiB
Lua

local HeroAttrUI = class("HeroAttrUI", BaseUI)
function HeroAttrUI:isFullScreen()
return false
end
function HeroAttrUI:getPrefabPath()
return "assets/prefabs/ui/hero/hero_attr_all_ui.prefab"
end
function HeroAttrUI:onPressBackspace()
self:closeUI()
end
function HeroAttrUI:ctor(parmas)
self.heroEntity = parmas.heroEntity
end
function HeroAttrUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
self.root:addClickListener(function()
self:closeUI()
end)
uiMap["hero_attr_all_ui.content.close_btn"]:addClickListener(function()
self:closeUI()
end)
uiMap["hero_attr_all_ui.content.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_30))
uiMap["hero_attr_all_ui.content.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_26))
uiMap["hero_attr_all_ui.content.hp_desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_27))
uiMap["hero_attr_all_ui.content.atk_desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_28))
uiMap["hero_attr_all_ui.content.desc_tx_2"]:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_29))
self.hpAttrTx = uiMap["hero_attr_all_ui.content.hp_attr_tx"]
self.atkAttrTx = uiMap["hero_attr_all_ui.content.atk_attr_tx"]
end
function HeroAttrUI:onRefresh()
local attr = self.heroEntity:getStarAttr()
self.hpAttrTx:setText(GFunc.getFinalAttrValue(GConst.ALL_ATTR.ATTR_HPP_ALL, attr.attr_hpp_all or 0, 2))
self.atkAttrTx:setText(GFunc.getFinalAttrValue(GConst.ALL_ATTR.ATTR_ATKP_ALL, attr.attr_atkp_all or 0, 2))
end
return HeroAttrUI