diff --git a/Runtime/UI/UIBase/UIBase.cs b/Runtime/UI/UIBase/UIBase.cs index 9036178..d702b26 100644 --- a/Runtime/UI/UIBase/UIBase.cs +++ b/Runtime/UI/UIBase/UIBase.cs @@ -213,10 +213,13 @@ namespace AlicizaX.UI.Runtime internal async UniTask InternalOpen() { - _state = UIState.Opened; - Visible = true; - Holder.OnWindowShowEvent?.Invoke(); - await OnOpenAsync(); + if (_state != UIState.Opened) + { + _state = UIState.Opened; + Visible = true; + Holder.OnWindowShowEvent?.Invoke(); + await OnOpenAsync(); + } } internal async UniTask InternalClose() diff --git a/Runtime/UI/UIBase/UIHolderObjectBase.cs b/Runtime/UI/UIBase/UIHolderObjectBase.cs index f81c129..22e88af 100644 --- a/Runtime/UI/UIBase/UIHolderObjectBase.cs +++ b/Runtime/UI/UIBase/UIHolderObjectBase.cs @@ -17,17 +17,14 @@ namespace AlicizaX.UI.Runtime public Action OnWindowClosedEvent; public Action OnWindowDestroyEvent; -#if UNITY_EDITOR && ALICIZAX_UI_ANIMATION_SUPPORT - private void SetAnimtionFlow() - { - // 编辑器模式下自动重置状态 - AnimationFlow = GetComponent(); - } -#endif #if ALICIZAX_UI_ANIMATION_SUPPORT public async UniTask PlayAnimtion(string name) { + if (AnimationFlow == null) + { + AnimationFlow = transform.GetComponent(); + } await AnimationFlow.PlayAsync(name); } #endif @@ -58,13 +55,7 @@ namespace AlicizaX.UI.Runtime internal set { _target.SetActive(value); } } -#if UNITY_EDITOR && ALICIZAX_UI_ANIMATION_SUPPORT - [InlineButton("SetAnimtionFlow")] -#endif - #if ALICIZAX_UI_ANIMATION_SUPPORT - [SerializeField] - [HideLabel] private AnimationFlow.Runtime.AnimationFlow AnimationFlow; #endif