57 lines
1.2 KiB
C#
57 lines
1.2 KiB
C#
|
|
|||
|
using DG.Tweening;
|
|||
|
using System.Collections;
|
|||
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class BasePanel : MonoBehaviour
|
|||
|
{
|
|||
|
public RectTransform panel; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> RectTransform
|
|||
|
public CanvasGroup canvasGroup; // <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
public virtual void Start()
|
|||
|
{
|
|||
|
panel = GetComponent<RectTransform>();
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
panel.localScale = Vector3.zero; // <20><>ʼ<EFBFBD><CABC><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD>ʾ<EFBFBD><CABE><EFBFBD>ɼ<EFBFBD>
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD>壨<EFBFBD><E5A3A8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public virtual void ShowPanel()
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ĵ<EFBFBD><C4B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><F0BDA5B5><EFBFBD>
|
|||
|
Sequence sequence = DOTween.Sequence();
|
|||
|
|
|||
|
// <20><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30><EFBFBD>ŵ<EFBFBD>1
|
|||
|
sequence.Append(panel.DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack));
|
|||
|
|
|||
|
// <><CDB8><EFBFBD>ȶ<EFBFBD><C8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0<EFBFBD><30>Ϊ1
|
|||
|
sequence.Join(canvasGroup.DOFade(1, 0.5f));
|
|||
|
|
|||
|
// <20><>ʼ<EFBFBD><CABC><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
|||
|
sequence.Play();
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>壨<EFBFBD>ջض<D5BB><D8B6><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
public virtual void HidePanel()
|
|||
|
{
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
Sequence sequence = DOTween.Sequence();
|
|||
|
|
|||
|
// <20><><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31><EFBFBD>Ż<EFBFBD>0
|
|||
|
sequence.Append(panel.DOScale(Vector3.zero, 0.3f).SetEase(Ease.InBack));
|
|||
|
|
|||
|
// <><CDB8><EFBFBD>ȶ<EFBFBD><C8B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>Ϊ0
|
|||
|
sequence.Join(canvasGroup.DOFade(0, 0.3f));
|
|||
|
|
|||
|
// <20><>ʼ<EFBFBD><CABC><EFBFBD>Ŷ<EFBFBD><C5B6><EFBFBD>
|
|||
|
sequence.Play();
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|