From 073b4cceaba65892c88be4d264aeb63a421d140f Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Wed, 19 Apr 2023 09:48:53 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/battle/cell/grid_cell.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lua/app/ui/battle/cell/grid_cell.lua b/lua/app/ui/battle/cell/grid_cell.lua index 7d21073f..4eeb9c1e 100644 --- a/lua/app/ui/battle/cell/grid_cell.lua +++ b/lua/app/ui/battle/cell/grid_cell.lua @@ -34,15 +34,22 @@ function GridCell:refresh(gridEntity, curElement) elementIcon:setVisible(false) skillIcon:setVisible(true) - if self.lastSkillId ~= skillId then - self.lastSkillId = skillId + local sprite + local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(skillId) + if skillEntity then + sprite = skillEntity:getBattleIcon() + else local cfg = ModuleManager.BattleManager.SKILL_CFG[skillId] if cfg then - skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, tostring(cfg.battle_icon)) + sprite = tostring(cfg.battle_icon) end end - local skillEntity = DataManager.BattleData:getSkillEntityBySkillId(gridEntity:getSkillId()) + if sprite and self.lastSkillSprite ~= sprite then + self.lastSkillSprite = sprite + skillIcon:setSprite(GConst.ATLAS_PATH.ICON_SKILL, self.lastSkillSprite) + end + elementType = gridEntity:getElementType(skillEntity) if not elementType then showMask = false