显示fix

This commit is contained in:
Fang 2023-07-25 18:16:44 +08:00
parent b2d2b65e73
commit 093decfeeb

View File

@ -101,26 +101,42 @@ function ArmorInfoComp:refreshSelectArmor()
local txNum = map["tx_num"]
obj:setVisible(true)
if not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK) and diffAtk > 0 then
if not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK) then
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK)
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_5")
txTitle:setText("<color=#FCB501>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3).."</color>")
txNum:setText(armorEntity:getAttack() // DEFAULT_FACTOR .. "<color=#A2FF29>+" .. diffAtk .. "</color>")
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT) and diffNormalHurt > 0 then
local numStr = armorEntity:getAttack() // DEFAULT_FACTOR
if diffAtk > 0 then
numStr = numStr .. "<color=#A2FF29>+" .. diffAtk .. "</color>"
end
txNum:setText(numStr)
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT) then
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT)
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_20")
txTitle:setText("<color=#4CCFFA>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT).."</color>")
txNum:setText(armorEntity:getNormalHurt() // DEFAULT_FACTOR .. "<color=#A2FF29>+" .. diffNormalHurt .. "</color>")
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT) and diffSkillHurt > 0 then
local numStr = armorEntity:getNormalHurt() // DEFAULT_FACTOR
if diffNormalHurt > 0 then
numStr = numStr .. "<color=#A2FF29>+" .. diffNormalHurt .. "</color>"
end
txNum:setText(numStr)
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT) then
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT)
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_21")
txTitle:setText("<color=#EC80FF>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT).."</color>")
txNum:setText(armorEntity:getSkillHurt() // DEFAULT_FACTOR .. "<color=#A2FF29>+" .. diffSkillHurt .. "</color>")
local numStr = armorEntity:getSkillHurt() // DEFAULT_FACTOR
if diffSkillHurt > 0 then
numStr = numStr .. "<color=#A2FF29>+" .. diffSkillHurt .. "</color>"
end
txNum:setText(numStr)
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.HP) and diffHp > 0 then
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.HP)
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_4")
txTitle:setText("<color=#FB6895>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2).."</color>")
txNum:setText(armorEntity:getHp() // DEFAULT_FACTOR .. "<color=#A2FF29>+" .. diffHp .. "</color>")
local numStr = armorEntity:getHp() // DEFAULT_FACTOR
if diffHp > 0 then
numStr = numStr .. "<color=#A2FF29>+" .. diffHp .. "</color>"
end
txNum:setText(numStr)
else
obj:setVisible(false)
end