From c1ed407a0f0ae1bb35f8f03b13a9282d96afb713 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 25 Apr 2023 15:49:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=98=BE=E7=A4=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../module/battle/controller/battle_controller.lua | 2 +- lua/app/ui/battle/battle_ui.lua | 9 ++++++--- lua/app/ui/battle/cell/grid_cell.lua | 6 ++++++ lua/app/ui/battle/cell/skill_node_cell.lua | 12 +++++++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index bf66b834..5297d63c 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -147,7 +147,7 @@ function BattleController:onLinkChange() end end - self.battleUI:refreshSkill(elementTypeMap) + self.battleUI:refreshSkill(elementTypeMap, true) if mainElementType then self.atkTeam:changeMainUnit(mainElementType) end diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index d5766981..d34f6430 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -532,7 +532,7 @@ function BattleUI:refreshDefHp(num, percent) end end -function BattleUI:refreshSkill(elementMap) +function BattleUI:refreshSkill(elementMap, showSfx) if not self.skillNodeCells then return end @@ -541,7 +541,7 @@ function BattleUI:refreshSkill(elementMap) if not self.skillNodeCells[elementType] then return end - self.skillNodeCells[elementType]:refresh(skillEntity, elementMap) + self.skillNodeCells[elementType]:refresh(skillEntity, elementMap, showSfx) end end @@ -737,9 +737,12 @@ function BattleUI:eliminationAni(sequence, callback) if entity and entity:getCell() then local baseObject = entity:getCell():getBaseObject() baseObject:getTransform():SetAsLastSibling() - if entity:getSkillId() or info.noAni then + if info.noAni then baseObject:setAnchoredPositionX(DEFAULT_X) else + if entity:getSkillId() then + entity:getCell():hideSkillSfx() + end self.eliminationAniSeq:Insert(index * 0.01, baseObject:getTransform():DOScale(1.3, 0.1)) self.eliminationAniSeq:InsertCallback(index * 0.01 + 0.2, function() self:getSfxSmoke(index, function(obj) diff --git a/lua/app/ui/battle/cell/grid_cell.lua b/lua/app/ui/battle/cell/grid_cell.lua index 84283707..20f358f3 100644 --- a/lua/app/ui/battle/cell/grid_cell.lua +++ b/lua/app/ui/battle/cell/grid_cell.lua @@ -156,6 +156,12 @@ function GridCell:showHighLight(show, mainElementType) end end +function GridCell:hideSkillSfx() + if self.outLineSfxObjs and self.outLineSfxObjs.skill then + self.outLineSfxObjs.skill:setActive(false) + end +end + function GridCell:resetTranform() local uiMap = self:getUIMap() self.baseObject:setLocalScale(1, 1, 1) diff --git a/lua/app/ui/battle/cell/skill_node_cell.lua b/lua/app/ui/battle/cell/skill_node_cell.lua index 511f1868..97eb962f 100644 --- a/lua/app/ui/battle/cell/skill_node_cell.lua +++ b/lua/app/ui/battle/cell/skill_node_cell.lua @@ -1,6 +1,6 @@ local SkillNodeCell = class("SkillNodeCell", BaseCell) -function SkillNodeCell:refresh(skillEntity, elementMap) +function SkillNodeCell:refresh(skillEntity, elementMap, showSfx) local elementType = skillEntity:getPosition() local add = 0 if elementMap and elementMap[elementType] then @@ -36,13 +36,19 @@ function SkillNodeCell:refresh(skillEntity, elementMap) end local effect = uiMap["skill_node_cell.icon_node.vfx_ui_battle_skill_full_b01"] - if value >= 1 then + if not self.lastValue then + self.lastValue = 0 + end + if add > 0 and value == 1 and showSfx and self.lastValue < value then effect:setVisible(true) effect:stopAndClear() effect:play() else - effect:setVisible(false) + if not showSfx then + effect:setVisible(false) + end end + self.lastValue = value end return SkillNodeCell \ No newline at end of file