From 8da1e7c9fc2def89e432bff771cb94c37ad5693d Mon Sep 17 00:00:00 2001 From: Chomper9981 Date: Wed, 25 Mar 2026 14:19:22 +0700 Subject: [PATCH] add delay for animation --- .../Players/CECPlayerActionPlayPolicy.cs | 4 +- Assets/Scripts/PlayerVisual.cs | 38 +++++++++++++++---- 2 files changed, 33 insertions(+), 9 deletions(-) diff --git a/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs b/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs index 19f10f9057..eab5b405cb 100644 --- a/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs +++ b/Assets/PerfectWorld/Scripts/Players/CECPlayerActionPlayPolicy.cs @@ -269,7 +269,7 @@ namespace BrewMonster return false; } m_isCastingSkill = true; - int iTransTime = 0; + int iTransTime = 200; EventBus.PublishChannel(m_pPlayer.GetPlayerInfo().cid, new PlayActionEvent(szActName,iTransTime)); return true; } @@ -285,7 +285,7 @@ namespace BrewMonster return false; } m_isCastingSkill = true; - int iTransTime = 0; + int iTransTime = 200; EventBus.PublishChannel(m_pPlayer.GetPlayerInfo().cid, new PlayActionEvent(szActName,iTransTime)); return true; } diff --git a/Assets/Scripts/PlayerVisual.cs b/Assets/Scripts/PlayerVisual.cs index 5e1a1ad249..551f726213 100644 --- a/Assets/Scripts/PlayerVisual.cs +++ b/Assets/Scripts/PlayerVisual.cs @@ -133,6 +133,7 @@ namespace BrewMonster //peek next if IsForceStopPrevious is true, force end if (_animationQueue.Peek().IsForceStopPrevious) { + Debug.Log($" InternalPlayAnimation PlayNext: Force Stop Previous"); _currentState.Stop(); _currentState = null; } @@ -173,7 +174,7 @@ namespace BrewMonster /// private void InternalPlayAnimation(string animationName, float duration = FadeTime, FadeMode fadeMode = FadeMode) { - + //Debug.Log($"InternalPlayAnimation: animationName FUllNAME={animationName}"); string fullName = animationName; string removeShapeName = animationName; string removeFlyName = animationName; @@ -183,17 +184,12 @@ namespace BrewMonster removeShapeName = animationName.Substring(underscoreIndex + 1); } - if (isDebug) - { - BMLogger.LogError($"InternalPlayAnimation: original={animationName}, removeShapeName={removeShapeName}"); - } - - bool isState = namedAnimancer.States.TryGet(removeShapeName, out var existingState) ? true : false; if (isState) { _currentState = namedAnimancer.TryPlay(removeShapeName, duration / 1000, fadeMode); _currentAnimationName = removeShapeName; + //Debug.Log($"InternalPlayAnimation: removeShapeName 1 TriggerName={removeShapeName}"); return; } bool isState2 = namedAnimancer.States.TryGet(fullName, out var existingState2) ? true : false; @@ -240,6 +236,34 @@ namespace BrewMonster _currentAnimationName = removeFlyName; return; } + if (fullName2.Contains("_通用")) + { + fullName2 = fullName2.Replace("_通用", ""); + removeShapeName = removeShapeName.Replace("_通用", ""); + removeFlyName = removeFlyName.Replace("_通用", ""); + } + bool isState6 = namedAnimancer.States.TryGet(fullName2, out var existingState6) ? true : false; + if (isState6) + { + _currentState = namedAnimancer.TryPlay(fullName2, duration / 1000, fadeMode); + _currentAnimationName = fullName2; + return; + } + + bool isState8 = namedAnimancer.States.TryGet(removeShapeName, out var existingState8) ? true : false; + if (isState8) + { + _currentState = namedAnimancer.TryPlay(removeShapeName, duration / 1000, fadeMode); + _currentAnimationName = removeShapeName; + return; + } + bool isState7 = namedAnimancer.States.TryGet(removeFlyName, out var existingState7) ? true : false; + if (isState7) + { + _currentState = namedAnimancer.TryPlay(removeFlyName, duration / 1000, fadeMode); + _currentAnimationName = removeFlyName; + return; + } BMLogger.LogError($"Null name animation: {fullName}"); }