diff --git a/Runtime/UI/Other/UIAnimationFlowTransition.cs b/Runtime/UI/Other/UIAnimationFlowTransition.cs index 389e651..4987f41 100644 --- a/Runtime/UI/Other/UIAnimationFlowTransition.cs +++ b/Runtime/UI/Other/UIAnimationFlowTransition.cs @@ -1,3 +1,4 @@ +#if ALICIZAX_UI_ANIMATION_SUPPORT using System.Threading; using Cysharp.Threading.Tasks; using UnityEngine; @@ -5,42 +6,24 @@ using UnityEngine; namespace AlicizaX.UI.Runtime { [DisallowMultipleComponent] - public sealed class UIAnimationFlowTransition : MonoBehaviour, IUITransitionPlayer + public sealed class UIAnimationFlowTransition : AnimationFlow.Runtime.AnimationFlow, IUITransitionPlayer { public int Priority => 0; -#if ALICIZAX_UI_ANIMATION_SUPPORT - [SerializeField] private AnimationFlow.Runtime.AnimationFlow animationFlow; [SerializeField] private string openClip = "Open"; [SerializeField] private string closeClip = "Close"; -#endif public UniTask PlayOpenAsync(CancellationToken cancellationToken = default) { -#if ALICIZAX_UI_ANIMATION_SUPPORT return PlayAsync(openClip, cancellationToken); -#else - return UniTask.CompletedTask; -#endif } public UniTask PlayCloseAsync(CancellationToken cancellationToken = default) { -#if ALICIZAX_UI_ANIMATION_SUPPORT return PlayAsync(closeClip, cancellationToken); -#else - return UniTask.CompletedTask; -#endif } - public void Stop() - { -#if ALICIZAX_UI_ANIMATION_SUPPORT - ResolveAnimationFlow()?.Stop(); -#endif - } -#if ALICIZAX_UI_ANIMATION_SUPPORT private UniTask PlayAsync(string clipName, CancellationToken cancellationToken) { if (cancellationToken.IsCancellationRequested || string.IsNullOrWhiteSpace(clipName)) @@ -48,29 +31,10 @@ namespace AlicizaX.UI.Runtime return UniTask.CompletedTask; } - AnimationFlow.Runtime.AnimationFlow flow = ResolveAnimationFlow(); - return flow == null ? UniTask.CompletedTask : flow.PlayAsync(clipName); - } - private AnimationFlow.Runtime.AnimationFlow ResolveAnimationFlow() - { - if (animationFlow == null) - { - animationFlow = GetComponent(); - } - - return animationFlow; + return PlayAsync(clipName); } - -#if UNITY_EDITOR - private void OnValidate() - { - if (animationFlow == null) - { - animationFlow = GetComponent(); - } - } -#endif -#endif } } + +#endif