diff --git a/Runtime/UXComponent/UXUIAnimation.cs b/Runtime/UXComponent/UXUIAnimation.cs index 2f95731..26651cd 100644 --- a/Runtime/UXComponent/UXUIAnimation.cs +++ b/Runtime/UXComponent/UXUIAnimation.cs @@ -17,6 +17,9 @@ namespace AlicizaX.UI.Extension.UXComponent [LabelText("关闭动画")] [BoxGroup("基础设置", true)] [ValueDropdown("GetAllAnimationClips", ExpandAllMenuItems = true)] [SerializeField] private string HideAnimationName; + [LabelText("关闭动画")] [BoxGroup("基础设置", true)] [ValueDropdown("GetAllAnimationClips", ExpandAllMenuItems = true)] [SerializeField] + private string InitAnimationName; + private UIHolderObjectBase _holderObjectBase; #if UNITY_EDITOR public List GetAllAnimationClips @@ -43,14 +46,24 @@ namespace AlicizaX.UI.Extension.UXComponent _holderObjectBase = GetComponent(); _holderObjectBase.OnWindowShowEvent += ShowAnimation; _holderObjectBase.OnWindowClosedEvent += CloseAnimation; + _holderObjectBase.OnWindowInitEvent += InitAnimation; } private void OnDestroy() { + _holderObjectBase.OnWindowInitEvent -= InitAnimation; _holderObjectBase.OnWindowShowEvent -= ShowAnimation; _holderObjectBase.OnWindowClosedEvent -= CloseAnimation; } + private void InitAnimation() + { + if (!string.IsNullOrEmpty(InitAnimationName)) + { + animationFlow.Play(InitAnimationName); + } + } + internal void ShowAnimation() { animationFlow.Play(ShowAnimationName);