装备界面显示fix
This commit is contained in:
parent
6f18d573a9
commit
4fe57bcfe8
@ -89,10 +89,14 @@ function ArmorInfoComp:refreshSelectArmor()
|
|||||||
self.txNextLevel:setText("+".. armorNextEntity:getLevel())
|
self.txNextLevel:setText("+".. armorNextEntity:getLevel())
|
||||||
|
|
||||||
-- 基础属性
|
-- 基础属性
|
||||||
local diffAtk = (armorNextEntity:getAttack() - armorEntity:getAttack()) // DEFAULT_FACTOR
|
local curAtk = armorEntity:getAttack()
|
||||||
local diffNormalHurt = (armorNextEntity:getNormalHurt() - armorEntity:getNormalHurt()) // DEFAULT_FACTOR
|
local curNormalHurt = armorEntity:getNormalHurt()
|
||||||
local diffSkillHurt = (armorNextEntity:getSkillHurt() - armorEntity:getSkillHurt()) // DEFAULT_FACTOR
|
local curSkillHurt = armorEntity:getSkillHurt()
|
||||||
local diffHp = (armorNextEntity:getHp() - armorEntity:getHp()) // DEFAULT_FACTOR
|
local curHp = armorEntity:getHp()
|
||||||
|
local diffBaseAtk = (armorNextEntity:getBaseAttack() - armorEntity:getBaseAttack()) // DEFAULT_FACTOR
|
||||||
|
local diffBaseNormalHurt = (armorNextEntity:getNormalHurt() - armorEntity:getNormalHurt()) // DEFAULT_FACTOR
|
||||||
|
local diffBaseSkillHurt = (armorNextEntity:getSkillHurt() - armorEntity:getSkillHurt()) // DEFAULT_FACTOR
|
||||||
|
local diffBaseHp = (armorNextEntity:getBaseHp() - armorEntity:getBaseHp()) // DEFAULT_FACTOR
|
||||||
local showAttrType = {}
|
local showAttrType = {}
|
||||||
for index, obj in ipairs(self.attr) do
|
for index, obj in ipairs(self.attr) do
|
||||||
local map = obj:genAllChildren()
|
local map = obj:genAllChildren()
|
||||||
@ -101,40 +105,40 @@ function ArmorInfoComp:refreshSelectArmor()
|
|||||||
local txNum = map["tx_num"]
|
local txNum = map["tx_num"]
|
||||||
obj:setVisible(true)
|
obj:setVisible(true)
|
||||||
|
|
||||||
if not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK) then
|
if not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK) and (curAtk > 0 or diffBaseAtk > 0) then
|
||||||
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK)
|
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK)
|
||||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_5")
|
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_5")
|
||||||
txTitle:setText("<color=#FCB501>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3).."</color>")
|
txTitle:setText("<color=#FCB501>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3).."</color>")
|
||||||
local numStr = armorEntity:getAttack() // DEFAULT_FACTOR
|
local numStr = curAtk // DEFAULT_FACTOR
|
||||||
if diffAtk > 0 then
|
if diffBaseAtk > 0 then
|
||||||
numStr = numStr .. "<color=#A2FF29>+" .. diffAtk .. "</color>"
|
numStr = numStr .. "<color=#A2FF29>+" .. diffBaseAtk .. "</color>"
|
||||||
end
|
end
|
||||||
txNum:setText(numStr)
|
txNum:setText(numStr)
|
||||||
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT) then
|
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT) and (curNormalHurt > 0 or diffBaseNormalHurt > 0) then
|
||||||
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT)
|
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT)
|
||||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_20")
|
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_20")
|
||||||
txTitle:setText("<color=#4CCFFA>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT).."</color>")
|
txTitle:setText("<color=#4CCFFA>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT).."</color>")
|
||||||
local numStr = armorEntity:getNormalHurt() // DEFAULT_FACTOR
|
local numStr = curNormalHurt // DEFAULT_FACTOR
|
||||||
if diffNormalHurt > 0 then
|
if diffBaseNormalHurt > 0 then
|
||||||
numStr = numStr .. "<color=#A2FF29>+" .. diffNormalHurt .. "</color>"
|
numStr = numStr .. "<color=#A2FF29>+" .. diffBaseNormalHurt .. "</color>"
|
||||||
end
|
end
|
||||||
txNum:setText(numStr)
|
txNum:setText(numStr)
|
||||||
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT) then
|
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT) and (curSkillHurt > 0 or diffBaseSkillHurt > 0) then
|
||||||
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT)
|
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT)
|
||||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_21")
|
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_21")
|
||||||
txTitle:setText("<color=#EC80FF>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT).."</color>")
|
txTitle:setText("<color=#EC80FF>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT).."</color>")
|
||||||
local numStr = armorEntity:getSkillHurt() // DEFAULT_FACTOR
|
local numStr = curSkillHurt // DEFAULT_FACTOR
|
||||||
if diffSkillHurt > 0 then
|
if diffBaseSkillHurt > 0 then
|
||||||
numStr = numStr .. "<color=#A2FF29>+" .. diffSkillHurt .. "</color>"
|
numStr = numStr .. "<color=#A2FF29>+" .. diffBaseSkillHurt .. "</color>"
|
||||||
end
|
end
|
||||||
txNum:setText(numStr)
|
txNum:setText(numStr)
|
||||||
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.HP) and diffHp > 0 then
|
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.HP) and (curHp > 0 or diffBaseHp > 0) then
|
||||||
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.HP)
|
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.HP)
|
||||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_4")
|
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_4")
|
||||||
txTitle:setText("<color=#FB6895>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2).."</color>")
|
txTitle:setText("<color=#FB6895>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2).."</color>")
|
||||||
local numStr = armorEntity:getHp() // DEFAULT_FACTOR
|
local numStr = curHp // DEFAULT_FACTOR
|
||||||
if diffHp > 0 then
|
if diffBaseHp > 0 then
|
||||||
numStr = numStr .. "<color=#A2FF29>+" .. diffHp .. "</color>"
|
numStr = numStr .. "<color=#A2FF29>+" .. diffBaseHp .. "</color>"
|
||||||
end
|
end
|
||||||
txNum:setText(numStr)
|
txNum:setText(numStr)
|
||||||
else
|
else
|
||||||
|
|||||||
@ -48,10 +48,14 @@ function WeaponInfoComp:refresh()
|
|||||||
self.attrContent:setAnchoredPosition(0, 0)
|
self.attrContent:setAnchoredPosition(0, 0)
|
||||||
|
|
||||||
-- 基础属性
|
-- 基础属性
|
||||||
local diffAtk = (nextWeaponEntity:getBaseAttack() - self.weaponEntity:getBaseAttack()) // DEFAULT_FACTOR
|
local curAtk = self.weaponEntity:getAttack()
|
||||||
local diffNormalHurt = (nextWeaponEntity:getNormalHurt() - self.weaponEntity:getNormalHurt()) // DEFAULT_FACTOR
|
local curNormalHurt = self.weaponEntity:getNormalHurt()
|
||||||
local diffSkillHurt = (nextWeaponEntity:getSkillHurt() - self.weaponEntity:getSkillHurt()) // DEFAULT_FACTOR
|
local curSkillHurt = self.weaponEntity:getSkillHurt()
|
||||||
local diffHp = (nextWeaponEntity:getBaseHp() - self.weaponEntity:getBaseHp()) // DEFAULT_FACTOR
|
local curHp = self.weaponEntity:getHp()
|
||||||
|
local diffBaseAtk = (nextWeaponEntity:getBaseAttack() - self.weaponEntity:getBaseAttack()) // DEFAULT_FACTOR
|
||||||
|
local diffBaseNormalHurt = (nextWeaponEntity:getNormalHurt() - self.weaponEntity:getNormalHurt()) // DEFAULT_FACTOR
|
||||||
|
local diffBaseSkillHurt = (nextWeaponEntity:getSkillHurt() - self.weaponEntity:getSkillHurt()) // DEFAULT_FACTOR
|
||||||
|
local diffBaseHp = (nextWeaponEntity:getBaseHp() - self.weaponEntity:getBaseHp()) // DEFAULT_FACTOR
|
||||||
local showAttrType = {}
|
local showAttrType = {}
|
||||||
for index, obj in ipairs(self.attr) do
|
for index, obj in ipairs(self.attr) do
|
||||||
local map = obj:genAllChildren()
|
local map = obj:genAllChildren()
|
||||||
@ -60,40 +64,40 @@ function WeaponInfoComp:refresh()
|
|||||||
local txNum = map["tx_num"]
|
local txNum = map["tx_num"]
|
||||||
obj:setVisible(true)
|
obj:setVisible(true)
|
||||||
|
|
||||||
if not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK) then
|
if not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK) and (curAtk > 0 or diffBaseAtk > 0) then
|
||||||
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK)
|
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.ATK)
|
||||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_5")
|
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_5")
|
||||||
txTitle:setText("<color=#FCB501>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3).."</color>")
|
txTitle:setText("<color=#FCB501>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3).."</color>")
|
||||||
local numStr = self.weaponEntity:getAttack() // DEFAULT_FACTOR
|
local numStr = curAtk // DEFAULT_FACTOR
|
||||||
if diffAtk > 0 then
|
if diffBaseAtk > 0 then
|
||||||
numStr = numStr .. "<color=#A2FF29>+" .. diffAtk .. "</color>"
|
numStr = numStr .. "<color=#A2FF29>+" .. diffBaseAtk .. "</color>"
|
||||||
end
|
end
|
||||||
txNum:setText(numStr)
|
txNum:setText(numStr)
|
||||||
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT) then
|
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT) and (curNormalHurt > 0 or diffBaseNormalHurt > 0) then
|
||||||
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT)
|
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.NORMAL_HURT)
|
||||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_20")
|
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_20")
|
||||||
txTitle:setText("<color=#4CCFFA>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT).."</color>")
|
txTitle:setText("<color=#4CCFFA>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT).."</color>")
|
||||||
local numStr = self.weaponEntity:getNormalHurt() // DEFAULT_FACTOR
|
local numStr = curNormalHurt // DEFAULT_FACTOR
|
||||||
if diffNormalHurt > 0 then
|
if diffBaseNormalHurt > 0 then
|
||||||
numStr = numStr .. "<color=#A2FF29>+" .. diffNormalHurt .. "</color>"
|
numStr = numStr .. "<color=#A2FF29>+" .. diffBaseNormalHurt .. "</color>"
|
||||||
end
|
end
|
||||||
txNum:setText(numStr)
|
txNum:setText(numStr)
|
||||||
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT) then
|
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT) and (curSkillHurt > 0 or diffBaseSkillHurt > 0) then
|
||||||
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT)
|
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.SKILL_HURT)
|
||||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_21")
|
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_21")
|
||||||
txTitle:setText("<color=#EC80FF>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT).."</color>")
|
txTitle:setText("<color=#EC80FF>"..I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT).."</color>")
|
||||||
local numStr = self.weaponEntity:getSkillHurt() // DEFAULT_FACTOR
|
local numStr = curSkillHurt // DEFAULT_FACTOR
|
||||||
if diffSkillHurt > 0 then
|
if diffBaseSkillHurt > 0 then
|
||||||
numStr = numStr .. "<color=#A2FF29>+" .. diffSkillHurt .. "</color>"
|
numStr = numStr .. "<color=#A2FF29>+" .. diffBaseSkillHurt .. "</color>"
|
||||||
end
|
end
|
||||||
txNum:setText(numStr)
|
txNum:setText(numStr)
|
||||||
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.HP) then
|
elseif not table.containValue(showAttrType, GConst.EquipConst.ATTR_TYPE.HP) and (curHp > 0 or diffBaseHp > 0) then
|
||||||
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.HP)
|
table.insert(showAttrType, GConst.EquipConst.ATTR_TYPE.HP)
|
||||||
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_4")
|
imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_4")
|
||||||
txTitle:setText("<color=#FB6895>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2).."</color>")
|
txTitle:setText("<color=#FB6895>"..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2).."</color>")
|
||||||
local numStr = self.weaponEntity:getHp() // DEFAULT_FACTOR
|
local numStr = curHp // DEFAULT_FACTOR
|
||||||
if diffHp > 0 then
|
if diffBaseHp > 0 then
|
||||||
numStr = numStr .. "<color=#A2FF29>+" .. diffHp .. "</color>"
|
numStr = numStr .. "<color=#A2FF29>+" .. diffBaseHp .. "</color>"
|
||||||
end
|
end
|
||||||
txNum:setText(numStr)
|
txNum:setText(numStr)
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user