属性计算修复

This commit is contained in:
Fang 2023-07-25 14:14:47 +08:00
parent c58bb1b185
commit 6a220afca8
2 changed files with 9 additions and 3 deletions

View File

@ -55,6 +55,7 @@ function HeroInfoComp:init()
end
function HeroInfoComp:setHeroData(heroEntity, onlyLook)
self.curLevel = heroEntity:getLv()
self.heroEntity = heroEntity
self.onlyLook = onlyLook
self:bind(self.heroEntity, "isDirty", function()
@ -62,7 +63,9 @@ function HeroInfoComp:setHeroData(heroEntity, onlyLook)
end)
end
function HeroInfoComp:refresh(lvChange)
function HeroInfoComp:refresh(checkLevel)
local isLvChange = checkLevel and self.curLevel ~= self.heroEntity:getLv()
self.txLv:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, self.heroEntity:getLv()))
self.spineObjAvatar:getSkeletonGraphic().enabled = false
@ -117,7 +120,7 @@ function HeroInfoComp:refresh(lvChange)
else
skillLv:setText(GConst.EMPTY_STRING)
skillBg:setSprite(GConst.ATLAS_PATH.ICON_SKILL_ROGUE, ModuleManager.HeroManager:getSkillRogueBg(skillId, true))
if i == activeCount and lvChange and self.heroEntity:getLv() == skillLvs[i] then
if i == activeCount and isLvChange and self.heroEntity:getLv() == skillLvs[i] then
local x, y = skillBg:fastGetAnchoredPosition()
self.spineObjSkill:setAnchoredPosition(x, y)
self.spineObjSkill:setVisible(true)
@ -177,7 +180,7 @@ function HeroInfoComp:refresh(lvChange)
self.btnUp:setTouchEnable(true)
self.btnUp:setActive(not self.heroEntity:isMaxLv())
if lvChange then
if isLvChange then
self.spineObj:setVisible(true)
self.spineObj:playAnim("idle", false, true)
end

View File

@ -418,13 +418,16 @@ end
-- 获取总基础攻击值(英雄+装备)
function HeroEntity:getTotalBaseAtk()
local result = self:getCfgAtk()
-- local logStr = self:getCfgId() .. "总基础攻击值:\n英雄" .. result
-- 武器 + 防具
for partName, partType in pairs(GConst.EquipConst.PART_TYPE) do
local equipEntity = self:getEquips(partType)
if equipEntity then
-- logStr = logStr .. "\n" .. partName .. "" .. equipEntity:getBaseAttack()
result = result + equipEntity:getBaseAttack()
end
end
-- Logger.logHighlight(logStr)
return result
end