diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua index 423d9e4a..3214e7f1 100644 --- a/lua/app/module/battle/battle_const.lua +++ b/lua/app/module/battle/battle_const.lua @@ -1013,8 +1013,7 @@ BattleConst.SKILL_LIGHT_POINT_SFX = "assets/prefabs/effects/battle/sfx_skill_b05 BattleConst.SKILL_LIGHT_LINE_SFX = "assets/prefabs/effects/battle/sfx_skill_b04.prefab" BattleConst.LINE_SFX = "assets/prefabs/effects/battle/sfx_c1_ui_line_b0%s.prefab" BattleConst.CHANGE_ELEMENT_SFX = "assets/prefabs/effects/battle/sfx_skill_b02.prefab" -BattleConst.LINK_SMOKE = "assets/prefabs/effects/battle/sfx_piece_smoke_b01.prefab" -BattleConst.LINK_SMOKE = "assets/prefabs/effects/battle/sfx_piece_smoke_b01.prefab" +BattleConst.LINK_SMOKE = "assets/prefabs/effects/battle/sfx_piece_smoke_b0%s.prefab" BattleConst.GRID_KILL_SFX = { [BattleConst.ELEMENT_TYPE.RED] = "assets/prefabs/effects/battle/sfx_piece_qizi_posui_b04.prefab", [BattleConst.ELEMENT_TYPE.YELLOW] = "assets/prefabs/effects/battle/sfx_piece_qizi_posui_b05.prefab", diff --git a/lua/app/ui/battle/battle_base_ui.lua b/lua/app/ui/battle/battle_base_ui.lua index 0fd7ba6c..43b3f0c5 100644 --- a/lua/app/ui/battle/battle_base_ui.lua +++ b/lua/app/ui/battle/battle_base_ui.lua @@ -820,21 +820,25 @@ function BattleBaseUI:initUISfxs() end if self.root.lineSfxObjs then - for index, info in pairs(self.root.lineSfxObjs) do - if info.obj then - info.obj:setActive(true) - info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), BOARD_SFX_ORDER) - info.obj:setActive(false) + for index, list in pairs(self.root.lineSfxObjs) do + for _, info in ipairs(list) do + if info.obj then + info.obj:setActive(true) + info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), BOARD_SFX_ORDER) + info.obj:setActive(false) + end end end end if self.root.smokeSfxObjs then - for index, info in pairs(self.root.smokeSfxObjs) do - if info.obj then - info.obj:setActive(true) - info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), BOARD_SFX_ORDER) - info.obj:setActive(false) + for index, list in pairs(self.root.smokeSfxObjs) do + for _, info in ipairs(list) do + if info.obj then + info.obj:setActive(true) + info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), BOARD_SFX_ORDER) + info.obj:setActive(false) + end end end end @@ -882,17 +886,21 @@ function BattleBaseUI:hideAllBoardSfxs() end if self.root.lineSfxObjs then - for index, info in pairs(self.root.lineSfxObjs) do - if info.obj then - info.obj:setActive(false) + for _, list in pairs(self.root.lineSfxObjs) do + for _, info in ipairs(list) do + if info.obj then + info.obj:setActive(false) + end end end end if self.root.smokeSfxObjs then - for index, info in pairs(self.root.smokeSfxObjs) do - if info.obj then - info.obj:setActive(false) + for index, list in pairs(self.root.smokeSfxObjs) do + for _, info in ipairs(list) do + if info.obj then + info.obj:setActive(false) + end end end end @@ -1470,7 +1478,7 @@ function BattleBaseUI:eliminationAni(aniSequence, effectGridMap, callback, side) end self.eliminationAniSeq:Insert(time, baseObject:getTransform():DOScale(1.3, 0.1)) self.eliminationAniSeq:InsertCallback(time + 0.2, function() - self:getSfxSmoke(index, function(obj) + self:getSfxSmoke(entity:getElementType(), index, function(obj) obj:setAnchoredPosition(pos.x, pos.y) obj:play() end) @@ -2191,7 +2199,6 @@ function BattleBaseUI:hideAllSfxLine() info.obj:setActive(false) end end - end end @@ -2337,24 +2344,24 @@ function BattleBaseUI:getSfxGridEffect(effectSfxPath, func) end) end -function BattleBaseUI:getSfxSmoke(index, func) +function BattleBaseUI:getSfxSmoke(elementType, index, func) self.hidingAllSfxSmoke = false - if not self.root.smokeSfxObjs then - self.root.smokeSfxObjs = {} - end - if self.root.smokeSfxObjs[index] then - if self.root.smokeSfxObjs[index].obj and func then - local obj = self.root.smokeSfxObjs[index].obj + self.root.smokeSfxObjs = self.root.smokeSfxObjs or {} + self.root.smokeSfxObjs[elementType] = self.root.smokeSfxObjs[elementType] or {} + if self.root.smokeSfxObjs[elementType] and self.root.smokeSfxObjs[elementType][index] then + if self.root.smokeSfxObjs[elementType][index].obj and func then + local obj = self.root.smokeSfxObjs[elementType][index].obj obj:setActive(true) func(obj) end else - self.root.smokeSfxObjs[index] = { + self.root.smokeSfxObjs[elementType][index] = { isLoaded = true } - EffectManager:loadUIEffectAsync(GConst.BattleConst.LINK_SMOKE, self, self.gridNode, BOARD_SFX_ORDER, function(obj) - self.root.smokeSfxObjs[index].obj = obj + local str = string.format(GConst.BattleConst.LINK_SMOKE, elementType) + EffectManager:loadUIEffectAsync(str, self, self.gridNode, BOARD_SFX_ORDER, function(obj) + self.root.smokeSfxObjs[elementType][index].obj = obj obj:setLocalScale(1.5, 1.5, 1.5) if self.hidingAllSfxSmoke then obj:setActive(false) @@ -2372,9 +2379,11 @@ function BattleBaseUI:hideAllSfxSmoke() if not self.root.smokeSfxObjs then return end - for inde, info in pairs(self.root.smokeSfxObjs) do - if info.obj then - info.obj:setActive(false) + for inde, list in pairs(self.root.smokeSfxObjs) do + for _, info in ipairs(list) do + if info.obj then + info.obj:setActive(false) + end end end end