diff --git a/lua/app/ui/hero/armor_info_comp.lua b/lua/app/ui/hero/armor_info_comp.lua index b6ccc150..376a71b8 100644 --- a/lua/app/ui/hero/armor_info_comp.lua +++ b/lua/app/ui/hero/armor_info_comp.lua @@ -89,10 +89,14 @@ function ArmorInfoComp:refreshSelectArmor() self.txNextLevel:setText("+".. armorNextEntity:getLevel()) -- 基础属性 - local diffAtk = (armorNextEntity:getAttack() - armorEntity:getAttack()) // DEFAULT_FACTOR - local diffNormalHurt = (armorNextEntity:getNormalHurt() - armorEntity:getNormalHurt()) // DEFAULT_FACTOR - local diffSkillHurt = (armorNextEntity:getSkillHurt() - armorEntity:getSkillHurt()) // DEFAULT_FACTOR - local diffHp = (armorNextEntity:getHp() - armorEntity:getHp()) // DEFAULT_FACTOR + local curAtk = armorEntity:getAttack() + local curNormalHurt = armorEntity:getNormalHurt() + local curSkillHurt = armorEntity:getSkillHurt() + 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 = {} for index, obj in ipairs(self.attr) do local map = obj:genAllChildren() @@ -101,40 +105,40 @@ function ArmorInfoComp:refreshSelectArmor() local txNum = map["tx_num"] 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) imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_5") txTitle:setText(""..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3).."") - local numStr = armorEntity:getAttack() // DEFAULT_FACTOR - if diffAtk > 0 then - numStr = numStr .. "+" .. diffAtk .. "" + local numStr = curAtk // DEFAULT_FACTOR + if diffBaseAtk > 0 then + numStr = numStr .. "+" .. diffBaseAtk .. "" end 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) imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_20") txTitle:setText(""..I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT).."") - local numStr = armorEntity:getNormalHurt() // DEFAULT_FACTOR - if diffNormalHurt > 0 then - numStr = numStr .. "+" .. diffNormalHurt .. "" + local numStr = curNormalHurt // DEFAULT_FACTOR + if diffBaseNormalHurt > 0 then + numStr = numStr .. "+" .. diffBaseNormalHurt .. "" end 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) imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_21") txTitle:setText(""..I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT).."") - local numStr = armorEntity:getSkillHurt() // DEFAULT_FACTOR - if diffSkillHurt > 0 then - numStr = numStr .. "+" .. diffSkillHurt .. "" + local numStr = curSkillHurt // DEFAULT_FACTOR + if diffBaseSkillHurt > 0 then + numStr = numStr .. "+" .. diffBaseSkillHurt .. "" end 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) imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_4") txTitle:setText(""..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2).."") - local numStr = armorEntity:getHp() // DEFAULT_FACTOR - if diffHp > 0 then - numStr = numStr .. "+" .. diffHp .. "" + local numStr = curHp // DEFAULT_FACTOR + if diffBaseHp > 0 then + numStr = numStr .. "+" .. diffBaseHp .. "" end txNum:setText(numStr) else diff --git a/lua/app/ui/hero/weapon_info_comp.lua b/lua/app/ui/hero/weapon_info_comp.lua index 4a900c54..2d95721f 100644 --- a/lua/app/ui/hero/weapon_info_comp.lua +++ b/lua/app/ui/hero/weapon_info_comp.lua @@ -48,10 +48,14 @@ function WeaponInfoComp:refresh() self.attrContent:setAnchoredPosition(0, 0) -- 基础属性 - local diffAtk = (nextWeaponEntity:getBaseAttack() - self.weaponEntity:getBaseAttack()) // DEFAULT_FACTOR - local diffNormalHurt = (nextWeaponEntity:getNormalHurt() - self.weaponEntity:getNormalHurt()) // DEFAULT_FACTOR - local diffSkillHurt = (nextWeaponEntity:getSkillHurt() - self.weaponEntity:getSkillHurt()) // DEFAULT_FACTOR - local diffHp = (nextWeaponEntity:getBaseHp() - self.weaponEntity:getBaseHp()) // DEFAULT_FACTOR + local curAtk = self.weaponEntity:getAttack() + local curNormalHurt = self.weaponEntity:getNormalHurt() + local curSkillHurt = self.weaponEntity:getSkillHurt() + 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 = {} for index, obj in ipairs(self.attr) do local map = obj:genAllChildren() @@ -60,40 +64,40 @@ function WeaponInfoComp:refresh() local txNum = map["tx_num"] 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) imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_5") txTitle:setText(""..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_3).."") - local numStr = self.weaponEntity:getAttack() // DEFAULT_FACTOR - if diffAtk > 0 then - numStr = numStr .. "+" .. diffAtk .. "" + local numStr = curAtk // DEFAULT_FACTOR + if diffBaseAtk > 0 then + numStr = numStr .. "+" .. diffBaseAtk .. "" end 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) imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_20") txTitle:setText(""..I18N:getGlobalText(I18N.GlobalConst.ATTR_NORMAL_HURT).."") - local numStr = self.weaponEntity:getNormalHurt() // DEFAULT_FACTOR - if diffNormalHurt > 0 then - numStr = numStr .. "+" .. diffNormalHurt .. "" + local numStr = curNormalHurt // DEFAULT_FACTOR + if diffBaseNormalHurt > 0 then + numStr = numStr .. "+" .. diffBaseNormalHurt .. "" end 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) imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_21") txTitle:setText(""..I18N:getGlobalText(I18N.GlobalConst.ATTR_SKILL_HURT).."") - local numStr = self.weaponEntity:getSkillHurt() // DEFAULT_FACTOR - if diffSkillHurt > 0 then - numStr = numStr .. "+" .. diffSkillHurt .. "" + local numStr = curSkillHurt // DEFAULT_FACTOR + if diffBaseSkillHurt > 0 then + numStr = numStr .. "+" .. diffBaseSkillHurt .. "" end 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) imgIcon:setSprite(GConst.ATLAS_PATH.COMMON, "common_dec_4") txTitle:setText(""..I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_2).."") - local numStr = self.weaponEntity:getHp() // DEFAULT_FACTOR - if diffHp > 0 then - numStr = numStr .. "+" .. diffHp .. "" + local numStr = curHp // DEFAULT_FACTOR + if diffBaseHp > 0 then + numStr = numStr .. "+" .. diffBaseHp .. "" end txNum:setText(numStr) else