boss入场动画
This commit is contained in:
parent
b6fc8538a2
commit
b7614062f0
@ -51,6 +51,37 @@ function UISpineObject:playAnim(animName, loop, forceRefresh, forceGetSG)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function UISpineObject:getAnimationKeyFrameTime(animName)
|
||||||
|
if not self.animationKeyFrameTime then
|
||||||
|
self.animationKeyFrameTime = {}
|
||||||
|
end
|
||||||
|
local timeList = self.animationKeyFrameTime[animName]
|
||||||
|
if not timeList then
|
||||||
|
timeList = {}
|
||||||
|
self.animationKeyFrameTime[animName] = timeList
|
||||||
|
if not self.uiSpineHelper then
|
||||||
|
self.uiSpineHelper = self:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_UI_SPINE_HELPER)
|
||||||
|
if self.uiSpineHelper == nil then
|
||||||
|
self.uiSpineHelper = self:addComponent(GConst.TYPEOF_UNITY_CLASS.BF_UI_SPINE_HELPER)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local list = self.uiSpineHelper:GetAnimationKeyFrameTime(animName)
|
||||||
|
local count = list.Count
|
||||||
|
if count > 0 then
|
||||||
|
for i = 1, count do
|
||||||
|
table.insert(timeList, list[i - 1])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return timeList
|
||||||
|
end
|
||||||
|
|
||||||
|
function UISpineObject:clearAnimationKeyFrameTime()
|
||||||
|
for aniName, _ in pairs(self.animationKeyFrameTime) do
|
||||||
|
self.animationKeyFrameTime[aniName] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
--未验证TODO
|
--未验证TODO
|
||||||
function UISpineObject:rePlayAnim(animName, loop, forceRefresh)
|
function UISpineObject:rePlayAnim(animName, loop, forceRefresh)
|
||||||
self:getAnimationState()
|
self:getAnimationState()
|
||||||
|
|||||||
@ -148,6 +148,7 @@ GConst.TYPEOF_UNITY_CLASS = {
|
|||||||
BF_UI_ERASER_TEXTURE = typeof(CS.BF.UIEraserTexture),
|
BF_UI_ERASER_TEXTURE = typeof(CS.BF.UIEraserTexture),
|
||||||
BF_UNITY_SLIDER = typeof(CS.BF.BFUnitySlider),
|
BF_UNITY_SLIDER = typeof(CS.BF.BFUnitySlider),
|
||||||
BF_ELIMINATION_TOUCH_EVENT = typeof(CS.BF.EliminationTouchEvent),
|
BF_ELIMINATION_TOUCH_EVENT = typeof(CS.BF.EliminationTouchEvent),
|
||||||
|
BF_UI_SPINE_HELPER = typeof(CS.BF.UISpineHelper),
|
||||||
}
|
}
|
||||||
|
|
||||||
-- lua 组件
|
-- lua 组件
|
||||||
|
|||||||
@ -15,6 +15,7 @@ local CacheVector2 = CS.UnityEngine.Vector2(0, 0)
|
|||||||
local CACHE_SKILL_POS_1 = {x = 10, y = 360}
|
local CACHE_SKILL_POS_1 = {x = 10, y = 360}
|
||||||
local CACHE_SKILL_POS_2 = {x = 10, y = 420}
|
local CACHE_SKILL_POS_2 = {x = 10, y = 420}
|
||||||
local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
|
local BATTLE_COMMON_PATH = "assets/arts/textures/background/battle_common/%s.png"
|
||||||
|
local BOARD_SFX_ORDER = 13
|
||||||
|
|
||||||
function BattleUI:getPrefabPath()
|
function BattleUI:getPrefabPath()
|
||||||
return "assets/prefabs/ui/battle/battle_ui.prefab"
|
return "assets/prefabs/ui/battle/battle_ui.prefab"
|
||||||
@ -1562,7 +1563,7 @@ function BattleUI:getSfxLine(index, func)
|
|||||||
self.root.lineSfxObjs[index] = {
|
self.root.lineSfxObjs[index] = {
|
||||||
isLoaded = true
|
isLoaded = true
|
||||||
}
|
}
|
||||||
EffectManager:loadUIEffectAsync(GConst.BattleConst.LINE_SFX, self, self.gridNode, 11, function(obj)
|
EffectManager:loadUIEffectAsync(GConst.BattleConst.LINE_SFX, self, self.gridNode, BOARD_SFX_ORDER, function(obj)
|
||||||
self.root.lineSfxObjs[index].obj = obj
|
self.root.lineSfxObjs[index].obj = obj
|
||||||
if self.hidingAllSfxLine then
|
if self.hidingAllSfxLine then
|
||||||
obj:setActive(false)
|
obj:setActive(false)
|
||||||
@ -1653,7 +1654,7 @@ function BattleUI:getSfxSmoke(index, func)
|
|||||||
self.root.smokeSfxObjs[index] = {
|
self.root.smokeSfxObjs[index] = {
|
||||||
isLoaded = true
|
isLoaded = true
|
||||||
}
|
}
|
||||||
EffectManager:loadUIEffectAsync(GConst.BattleConst.LINK_SMOKE, self, self.gridNode, 11, function(obj)
|
EffectManager:loadUIEffectAsync(GConst.BattleConst.LINK_SMOKE, self, self.gridNode, BOARD_SFX_ORDER, function(obj)
|
||||||
self.root.smokeSfxObjs[index].obj = obj
|
self.root.smokeSfxObjs[index].obj = obj
|
||||||
obj:setLocalScale(1.5, 1.5, 1.5)
|
obj:setLocalScale(1.5, 1.5, 1.5)
|
||||||
if self.hidingAllSfxSmoke then
|
if self.hidingAllSfxSmoke then
|
||||||
@ -1843,7 +1844,7 @@ function BattleUI:initUISfxs()
|
|||||||
for index, info in pairs(self.root.lineSfxObjs) do
|
for index, info in pairs(self.root.lineSfxObjs) do
|
||||||
if info.obj then
|
if info.obj then
|
||||||
info.obj:setActive(true)
|
info.obj:setActive(true)
|
||||||
info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), 11)
|
info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), BOARD_SFX_ORDER)
|
||||||
info.obj:setActive(false)
|
info.obj:setActive(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1853,7 +1854,7 @@ function BattleUI:initUISfxs()
|
|||||||
for index, info in pairs(self.root.smokeSfxObjs) do
|
for index, info in pairs(self.root.smokeSfxObjs) do
|
||||||
if info.obj then
|
if info.obj then
|
||||||
info.obj:setActive(true)
|
info.obj:setActive(true)
|
||||||
info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), 11)
|
info.obj:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_EFFECT_HELPER):SetSortingOrder(self:getUIOrder(), BOARD_SFX_ORDER)
|
||||||
info.obj:setActive(false)
|
info.obj:setActive(false)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -2035,7 +2036,7 @@ end
|
|||||||
function BattleUI:initBossEnterAni()
|
function BattleUI:initBossEnterAni()
|
||||||
local uiMap = self.root:genAllChildren()
|
local uiMap = self.root:genAllChildren()
|
||||||
self.bossEnterNode = uiMap["battle_ui.bg_2.boss_enter_node"]
|
self.bossEnterNode = uiMap["battle_ui.bg_2.boss_enter_node"]
|
||||||
self.bossEnterImg = uiMap["battle_ui.bg_2.boss_enter_node.img"]
|
self.bossEnterImg = uiMap["battle_ui.bg_2.boss_enter_node.ui_spine_obj"]
|
||||||
self.bossName = uiMap["battle_ui.bg_2.boss_enter_node.boss_name"]
|
self.bossName = uiMap["battle_ui.bg_2.boss_enter_node.boss_name"]
|
||||||
self.bossEnterNodeCanvasGroup = self.bossEnterNode:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
self.bossEnterNodeCanvasGroup = self.bossEnterNode:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||||
self.bossEnterNode:setVisible(false)
|
self.bossEnterNode:setVisible(false)
|
||||||
@ -2051,9 +2052,15 @@ function BattleUI:showBossEnterAni(bornTime, bossName, monsterComp, callback)
|
|||||||
end
|
end
|
||||||
self.bossEnterNode:setVisible(true)
|
self.bossEnterNode:setVisible(true)
|
||||||
self.bossEnterImg:setVisible(false)
|
self.bossEnterImg:setVisible(false)
|
||||||
self.bossName:setText(GConst.EMPTY_STRING)
|
self.bossName:setText(bossName)
|
||||||
|
self.bossName:setAnchoredPositionX(-800)
|
||||||
self.bossEnterNodeCanvasGroup.alpha = 0
|
self.bossEnterNodeCanvasGroup.alpha = 0
|
||||||
monsterComp:getBaseObject():setLocalPosition(DEFAULT_X, 0, 0)
|
monsterComp:getBaseObject():setLocalPosition(DEFAULT_X, 0, 0)
|
||||||
|
local keyFrameTimes = self.bossEnterImg:getAnimationKeyFrameTime("idle")
|
||||||
|
local keyFrameTime = 0
|
||||||
|
if keyFrameTimes then
|
||||||
|
keyFrameTime = keyFrameTimes[1] or 0
|
||||||
|
end
|
||||||
if self.bossEnterAniSeq then
|
if self.bossEnterAniSeq then
|
||||||
self.bossEnterAniSeq:Kill()
|
self.bossEnterAniSeq:Kill()
|
||||||
self.bossEnterAniSeq = nil
|
self.bossEnterAniSeq = nil
|
||||||
@ -2062,23 +2069,34 @@ function BattleUI:showBossEnterAni(bornTime, bossName, monsterComp, callback)
|
|||||||
self.bossEnterAniSeq:Append(self.bossEnterNodeCanvasGroup:DOFade(1, 0.2))
|
self.bossEnterAniSeq:Append(self.bossEnterNodeCanvasGroup:DOFade(1, 0.2))
|
||||||
self.bossEnterAniSeq:AppendCallback(function()
|
self.bossEnterAniSeq:AppendCallback(function()
|
||||||
self.bossEnterImg:setVisible(true)
|
self.bossEnterImg:setVisible(true)
|
||||||
|
self.bossEnterImg:playAnim("idle", false, true)
|
||||||
monsterComp:initPosition()
|
monsterComp:initPosition()
|
||||||
monsterComp:getBaseObject():setParent(self.maxLayerNode, false)
|
monsterComp:getBaseObject():setParent(self.maxLayerNode, false)
|
||||||
if callback then
|
if callback then
|
||||||
callback()
|
callback()
|
||||||
end
|
end
|
||||||
self.battleController:showBuffTips(GConst.BattleConst.SIDE_DEF, true)
|
|
||||||
end)
|
end)
|
||||||
self.bossEnterAniSeq:AppendInterval(bornTime)
|
self.bossEnterAniSeq:AppendInterval(2)
|
||||||
self.bossEnterAniSeq:AppendCallback(function()
|
|
||||||
self.bossName:setText(bossName)
|
|
||||||
end)
|
|
||||||
self.bossEnterAniSeq:AppendInterval(0.5)
|
|
||||||
self.bossEnterAniSeq:Append(self.bossEnterNodeCanvasGroup:DOFade(0, 0.2))
|
self.bossEnterAniSeq:Append(self.bossEnterNodeCanvasGroup:DOFade(0, 0.2))
|
||||||
self.bossEnterAniSeq:AppendCallback(function()
|
self.bossEnterAniSeq:AppendCallback(function()
|
||||||
monsterComp:getBaseObject():setParent(self:getBattleNode(), false)
|
monsterComp:getBaseObject():setParent(self:getBattleNode(), false)
|
||||||
self.bossEnterNode:setVisible(false)
|
self.bossEnterNode:setVisible(false)
|
||||||
|
self.battleController:showBuffTips(GConst.BattleConst.SIDE_DEF, true)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
if keyFrameTime > 0 then
|
||||||
|
local addTime = 1
|
||||||
|
self.bossEnterAniSeq:InsertCallback(keyFrameTime + 0.2, function()
|
||||||
|
self.bossName:setText(bossName)
|
||||||
|
self.battleController:setTimeScale(0)
|
||||||
|
end)
|
||||||
|
self.bossEnterAniSeq:Insert(keyFrameTime + 0.2, self.bossName:getTransform():DOAnchorPosX(-212, 0.2))
|
||||||
|
self.bossEnterAniSeq:InsertCallback(keyFrameTime + 0.2 + addTime, function()
|
||||||
|
self.battleController:setTimeScale(DataManager.BattleData:getTimeScale())
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
self.bossEnterAniSeq:Insert(0.2, self.bossName:getTransform():DOAnchorPosX(-212, 0.2))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:clear()
|
function BattleUI:clear()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user