diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Actor/ActorHItem.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Actor/ActorHItem.cs index d31b4429..c45dc322 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Actor/ActorHItem.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Actor/ActorHItem.cs @@ -269,12 +269,17 @@ namespace GameLogic List m_ListEgo = new List(); + private bool m_IsFillAnimPlaying = false; public void SetCurrenFill() { + if (m_IsFillAnimPlaying) + return; // 动画正在播放,直接返回 + + m_IsFillAnimPlaying = true; // 给进度条一个缩减回弹效果 float originalFill = m_CurrentFillAmount; - float shrinkTo = Mathf.Max(0.1f, originalFill - 0.2f); // 缩到原值-0.4,最小0.1 + float shrinkTo = Mathf.Max(0.1f, originalFill - 0.2f); // 缩到原值-0.2,最小0.1 DOTween.To( () => m_imgValue.fillAmount, x => m_imgValue.fillAmount = x, @@ -285,10 +290,15 @@ namespace GameLogic () => m_imgValue.fillAmount, x => m_imgValue.fillAmount = x, originalFill, 0.35f - ).SetEase(Ease.OutElastic); + ).SetEase(Ease.OutElastic) + .OnComplete(() => + { + m_IsFillAnimPlaying = false; // 动画播放完毕,允许再次播放 + }); }); } + /// /// 增加礼物推力效果 /// diff --git a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Manager/DataGameSceneManager.cs b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Manager/DataGameSceneManager.cs index 3cc790b7..2b8b334b 100644 --- a/UnityProject/Assets/GameScripts/HotFix/GameLogic/Manager/DataGameSceneManager.cs +++ b/UnityProject/Assets/GameScripts/HotFix/GameLogic/Manager/DataGameSceneManager.cs @@ -876,6 +876,7 @@ namespace GameLogic }); var JszSignal = GameModule.Resource.LoadAsset("JszSignal"); + eGo.GetComponent().GetReaction(JszSignal).RemoveAllListeners(); eGo.GetComponent().GetReaction(JszSignal).AddListener(() => { hItemActors[1].actor.SetCurrenFill(); @@ -898,10 +899,12 @@ namespace GameLogic var JszSignal = GameModule.Resource.LoadAsset("JszSignal"); + eGo.GetComponent().GetReaction(JszSignal).RemoveAllListeners(); eGo.GetComponent().GetReaction(JszSignal).AddListener(() => { hItemActors[0].actor.SetCurrenFill(); }); + } }, 2);