From 9479a931f6324a439adb82e08aefe873bf088ecb Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Tue, 25 Apr 2023 15:08:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=80=E8=83=BD=E7=94=9F=E6=88=90=E7=89=B9?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../battle/controller/battle_controller.lua | 4 ++- lua/app/ui/battle/battle_ui.lua | 30 ++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lua/app/module/battle/controller/battle_controller.lua b/lua/app/module/battle/controller/battle_controller.lua index 77274349..bf66b834 100644 --- a/lua/app/module/battle/controller/battle_controller.lua +++ b/lua/app/module/battle/controller/battle_controller.lua @@ -131,10 +131,12 @@ function BattleController:onLinkChange() cell:showHighLight(false) end + local influenceMap = {} for posId, info in pairs(self.battleData:getSkillInfluenceGrids()) do local entity = self.battleData:getGridEntity(posId) - if not posIdMap[posId] and info.direction ~= BattleConst.BOARD_RANGE_TYPE.RANDOM then + if not influenceMap[posId] and info.direction ~= BattleConst.BOARD_RANGE_TYPE.RANDOM then posIdMap[posId] = true + influenceMap[posId] = true if not entity:getSkillId() then local elementType = entity:getElementType() elementTypeMap[elementType] = (elementTypeMap[elementType] or 0) + 1 diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index 176aaaab..63a4bfe5 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -58,6 +58,7 @@ function BattleUI:_display() self:initSkillSelectCells() self:hideAllSfxSmoke() self:initSkillLineSfx() + self:initGenerateSkillEffect() end function BattleUI:_addListeners() @@ -790,9 +791,11 @@ function BattleUI:generateSkillAni(map, callback) end self.generateSkillAniSeq = self.root:createBindTweenSequence() + local count = 0 for elementType, info in pairs(map) do local entity = self.generateSkillGridEntities[elementType] if entity and entity:getCell() then + count = count + 1 entity:setSkilId(info.skillId) local cell = entity:getCell() cell:refresh(entity) @@ -802,6 +805,13 @@ function BattleUI:generateSkillAni(map, callback) end) local pos = ModuleManager.BattleManager:getPosInfo(info.posId) self.generateSkillAniSeq:Append(cell:getBaseObject():getTransform():DOAnchorPos(pos, 0.5)) + if self.generateSkillSfxs and self.generateSkillSfxs[count] then + self.generateSkillSfxs[count]:setAnchoredPosition(pos.x, pos.y) + self.generateSkillAniSeq:AppendCallback(function() + self.generateSkillSfxs[count]:setActive(true) + self.generateSkillSfxs[count]:play() + end) + end end end self.generateSkillAniSeq:AppendCallback(function() @@ -834,6 +844,24 @@ function BattleUI:hideGenerateSkillGridCells() end end +function BattleUI:initGenerateSkillEffect() + if not self.generateSkillSfxs then + local uiMap = self.root:genAllChildren() + self.generateSkillSfxs = {} + self.generateSkillSfxs[1] = uiMap["battle_ui.bg_2.ani_node.sfx_piece_skill_b01_1"] + self.generateSkillSfxs[2] = uiMap["battle_ui.bg_2.ani_node.sfx_piece_skill_b01_2"] + self.generateSkillSfxs[3] = uiMap["battle_ui.bg_2.ani_node.sfx_piece_skill_b01_3"] + self.generateSkillSfxs[4] = uiMap["battle_ui.bg_2.ani_node.sfx_piece_skill_b01_4"] + self.generateSkillSfxs[5] = uiMap["battle_ui.bg_2.ani_node.sfx_piece_skill_b01_5"] + end + + for _, obj in pairs(self.generateSkillSfxs) do + obj:setActive(true) + obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), GConst.UI_EFFECT_ORDER.LEVEL1) + obj:setActive(false) + end +end + function BattleUI:gotOneSkillAni(skillId, elementType, callback, startPos) if not skillId or not self.skillSelectCell then if callback then @@ -912,7 +940,7 @@ function BattleUI:fallGrid(listInfo, callback) cell.fallSeq = baseObject:createBindTweenSequence() baseObject:setAnchoredPosition(info[1].x, info[1].y) local count = #info - cell.fallSeq:Append(baseObject:getTransform():DOLocalPath(info, GConst.BattleConst.ONE_STEP_TIME * count):SetEase(CS.DG.Tweening.Ease.OutCubic)) + cell.fallSeq:Append(baseObject:getTransform():DOLocalPath(info, GConst.BattleConst.ONE_STEP_TIME * count):SetEase(CS.DG.Tweening.Ease.InOutQuint)) cell.fallSeq:AppendCallback(function() self.fallAniCount = self.fallAniCount - 1 if self.fallAniCount == 0 then