技能生成特效

This commit is contained in:
xiekaidong 2023-04-25 15:08:28 +08:00
parent 1e1d9cd913
commit 9479a931f6
2 changed files with 32 additions and 2 deletions

View File

@ -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

View File

@ -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