This commit is contained in:
陈思海 2025-10-22 16:25:30 +08:00
parent 2ffaf6e1bf
commit f71b5c3c7c

View File

@ -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<string> GetAllAnimationClips
@ -43,14 +46,24 @@ namespace AlicizaX.UI.Extension.UXComponent
_holderObjectBase = GetComponent<UIHolderObjectBase>();
_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);