Files
5.24BuYu/Assets/Framework/Tool/UITool/SubUIBase.cs
T
2026-05-02 23:52:48 +08:00

70 lines
1.5 KiB
C#

using DG.Tweening;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public enum UIEffect
{
none = 0,
tan = 1,
}
public class SubUIBase : UIBase
{
[HideInInspector] public SubUIManager uIManager;
public Button btn_Close;
Vector3 standardSize=Vector3.one;
public UIEffect uIEffect=UIEffect.tan;
public virtual void Awake()
{
standardSize = transform.GetChild(0).localScale;
btn_Close.onClick.AddListener(() =>
{
uIManager.Hide(this);
});
}
protected override void OnShow(object args = null)
{
base.OnShow(args);
switch (uIEffect)
{
case UIEffect.none:
break;
case UIEffect.tan:
transform.GetChild(0).localScale = Vector3.zero;
transform.GetChild(0)
.DOScale(standardSize, 0.55f)
.SetEase(Ease.OutElastic, 0.7f, 0.35f);
break;
default:
break;
}
}
public override void Hide()
{
switch (uIEffect)
{
case UIEffect.none:
base.Hide();
break;
case UIEffect.tan:
transform.GetChild(0)
.DOScale(0, 0.3f)
.SetEase(Ease.InBack).onComplete += () =>
{
base.Hide();
};
break;
default:
base.Hide();
break;
}
}
}