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)
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 = DataManager.HeroData:getAllStarAttr()
	self.hpAttrTx:setText(GFunc.getFinalAttrValue(GConst.ATTR_ALL.ATTR_HPP_ALL, attr.attr_hpp_all or 0, 2))
	self.atkAttrTx:setText(GFunc.getFinalAttrValue(GConst.ATTR_ALL.ATTR_ATKP_ALL, attr.attr_atkp_all or 0, 2))
end

return HeroAttrUI