46 lines
1.1 KiB
C#
46 lines
1.1 KiB
C#
|
using DG.Tweening;
|
|||
|
using UnityEngine;
|
|||
|
|
|||
|
public class BasePanel_2 : MonoBehaviour
|
|||
|
{
|
|||
|
public CanvasGroup canvasGroup; // <20><><EFBFBD>ڿ<EFBFBD><DABF><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>
|
|||
|
|
|||
|
public virtual void Start()
|
|||
|
{
|
|||
|
// <20><>ȡ CanvasGroup <20><><EFBFBD><EFBFBD>
|
|||
|
if (canvasGroup == null)
|
|||
|
{
|
|||
|
canvasGroup = GetComponent<CanvasGroup>();
|
|||
|
}
|
|||
|
|
|||
|
// <20><>ʼ״̬<D7B4><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
canvasGroup.alpha = 0; // <20><>ȫ<C8AB><CDB8>
|
|||
|
canvasGroup.interactable = false; // <20><><EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD>
|
|||
|
canvasGroup.blocksRaycasts = false; // <20><><EFBFBD>赲<EFBFBD><E8B5B2><EFBFBD><EFBFBD>
|
|||
|
}
|
|||
|
|
|||
|
// <20><>ʾ<EFBFBD><CABE><EFBFBD>壨<EFBFBD><E5A3A8><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
|||
|
public virtual void ShowPanel()
|
|||
|
{
|
|||
|
// <><CDB8><EFBFBD>ȴ<EFBFBD>0<EFBFBD><EFBFBD>Ϊ1
|
|||
|
canvasGroup.DOFade(1, 0.8f).OnStart(() =>
|
|||
|
{
|
|||
|
// <20><>ʼʱ<CABC><CAB1><EFBFBD><EFBFBD>Ϊ<EFBFBD>ɽ<EFBFBD><C9BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>赲<EFBFBD><E8B5B2><EFBFBD><EFBFBD>
|
|||
|
canvasGroup.interactable = true;
|
|||
|
canvasGroup.blocksRaycasts = true;
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>壨<EFBFBD><E5A3A8><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
|||
|
public virtual void HidePanel()
|
|||
|
{
|
|||
|
// <><CDB8><EFBFBD>ȴ<EFBFBD>1<EFBFBD><EFBFBD>Ϊ0
|
|||
|
canvasGroup.DOFade(0, 0.8f).OnComplete(() =>
|
|||
|
{
|
|||
|
// <20><><EFBFBD>ɺ<EFBFBD><C9BA><EFBFBD><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>赲<EFBFBD><E8B5B2><EFBFBD><EFBFBD>
|
|||
|
canvasGroup.interactable = false;
|
|||
|
canvasGroup.blocksRaycasts = false;
|
|||
|
});
|
|||
|
}
|
|||
|
}
|