水泡动画
This commit is contained in:
parent
5a9558184b
commit
14f51d2900
@ -34,6 +34,18 @@ function EffectObject:play()
|
||||
self.effectHelper:Play()
|
||||
end
|
||||
|
||||
function EffectObject:playComplete(complete, customTime)
|
||||
self.effectHelper:Play()
|
||||
local duration = customTime or self:getDuration()
|
||||
if self.playCompleteSeq then
|
||||
self.playCompleteSeq:Kill()
|
||||
self.playCompleteSeq = nil
|
||||
end
|
||||
self.playCompleteSeq = self:createBindTweenSequence()
|
||||
self.playCompleteSeq:AppendInterval(duration)
|
||||
self.playCompleteSeq:AppendCallback(complete)
|
||||
end
|
||||
|
||||
-- 延迟播放
|
||||
function EffectObject:playDelay(delayTime, hideBeforePlay)
|
||||
if delayTime <= 0 then
|
||||
|
||||
@ -30,7 +30,13 @@ local function _crossSpread(entity, gridEntities, battleController, onlyCheck)
|
||||
for _, posId in ipairs(tempList) do
|
||||
local gridEntity = gridEntities[posId]
|
||||
if gridEntity:isEmptyIdle() then
|
||||
if battleController.battleUI and entity:getEffectSfx() then
|
||||
battleController.battleUI:showGridEffectSfx(posId, entity:getEffectSfx(), function()
|
||||
battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY)
|
||||
end)
|
||||
else
|
||||
battleController.battleData:setGridType(posId, entity:getGridType() or BattleConst.GRID_TYPE.JELLY)
|
||||
end
|
||||
succ = true
|
||||
break
|
||||
end
|
||||
|
||||
@ -1082,6 +1082,22 @@ function BattleUI:dealGridEffectSfx(time, info, breakSfxNameIndexMap, entity)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUI:showGridEffectSfx(posId, sfxName, callback)
|
||||
self:getSfxGridEffect(sfxName, function(info)
|
||||
info.isIdle = false
|
||||
local pos = ModuleManager.BattleManager:getPosInfo(posId)
|
||||
info.obj:setLocalPosition(pos.x, pos.y, 0)
|
||||
info.obj:setActive(true)
|
||||
info.obj:playComplete(function()
|
||||
info.isIdle = true
|
||||
info.obj:setActive(false)
|
||||
if callback then
|
||||
callback()
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:generateSkillAni(map, callback)
|
||||
if table.nums(map) <= 0 then
|
||||
if callback then
|
||||
@ -1698,6 +1714,39 @@ function BattleUI:resetParentAllSfxGridBreak()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUI:getSfxGridEffect(effectSfxPath, func)
|
||||
if not effectSfxPath then
|
||||
return
|
||||
end
|
||||
|
||||
if not self.root.gridEffectSfx then
|
||||
self.root.gridEffectSfx = {}
|
||||
end
|
||||
if not self.root.gridEffectSfx[effectSfxPath] then
|
||||
self.root.gridEffectSfx[effectSfxPath] = {}
|
||||
end
|
||||
local count = 0
|
||||
for index, info in pairs(self.root.gridEffectSfx[effectSfxPath]) do
|
||||
if info.isIdle then
|
||||
func(self.root.gridEffectSfx[effectSfxPath][index])
|
||||
return
|
||||
end
|
||||
count = count + 1
|
||||
end
|
||||
|
||||
local index = count + 1
|
||||
self.root.gridEffectSfx[effectSfxPath][index] = {
|
||||
isLoaded = true,
|
||||
}
|
||||
EffectManager:loadUIEffectAsync(effectSfxPath, self, self.gridNode, GConst.UI_EFFECT_ORDER.LEVEL5, function(obj)
|
||||
self.root.gridEffectSfx[effectSfxPath][index].obj = obj
|
||||
self.root.gridEffectSfx[effectSfxPath][index].isIdle = true
|
||||
if func then
|
||||
func(self.root.gridEffectSfx[effectSfxPath][index])
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:getSfxSmoke(index, func)
|
||||
self.hidingAllSfxSmoke = false
|
||||
|
||||
@ -1900,6 +1949,18 @@ function BattleUI:initUISfxs()
|
||||
end
|
||||
end
|
||||
|
||||
if self.root.gridEffectSfx then
|
||||
for breakSfxPath, list in pairs(self.root.gridEffectSfx) do
|
||||
for index, info in pairs(list) do
|
||||
if info.obj then
|
||||
info.obj:setActive(true)
|
||||
info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), GConst.UI_EFFECT_ORDER.LEVEL5)
|
||||
info.obj:setActive(false)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if self.root.lineSfxObjs then
|
||||
for index, info in pairs(self.root.lineSfxObjs) do
|
||||
if info.obj then
|
||||
@ -2256,6 +2317,11 @@ function BattleUI:clear()
|
||||
self.bossEnterAniSeq:Kill()
|
||||
self.bossEnterAniSeq = nil
|
||||
end
|
||||
|
||||
if self.showGridEffectSfxSid then
|
||||
self:unscheduleGlobal(self.showGridEffectSfxSid)
|
||||
self.showGridEffectSfxSid = nil
|
||||
end
|
||||
end
|
||||
|
||||
return BattleUI
|
||||
Loading…
x
Reference in New Issue
Block a user