37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using DG.Tweening;
|
|
using UnityEngine;
|
|
|
|
namespace AssetUpdate
|
|
{
|
|
public class LiteWindow : MonoBehaviour
|
|
{
|
|
public RectTransform panelRoot { get; private set; }
|
|
public CanvasGroup canvasGroup { get; private set; }
|
|
public bool closing { get; private set; }
|
|
|
|
protected virtual void Awake()
|
|
{
|
|
panelRoot = (RectTransform)transform.Find("Panel");
|
|
panelRoot.localScale = Vector3.one * 0.5f;
|
|
panelRoot.DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack);
|
|
canvasGroup = panelRoot.GetComponent<CanvasGroup>();
|
|
canvasGroup.alpha = 0f;
|
|
canvasGroup.DOFade(1f, 0.5f).SetEase(Ease.OutQuart);
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
if (!closing)
|
|
{
|
|
closing = true;
|
|
panelRoot.DOScale(Vector3.zero, 0.5f).SetEase(Ease.OutBack).OnComplete(OnCloseComplete);
|
|
canvasGroup.DOFade(0f, 0.5f).SetEase(Ease.OutQuart);
|
|
}
|
|
}
|
|
|
|
protected virtual void OnCloseComplete()
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
} |