76 lines
1.3 KiB
C#
76 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using Cysharp.Threading.Tasks;
|
|
using A2W;
|
|
|
|
public class LoadingPanel : UIPanel, ITransition
|
|
{
|
|
[SerializeField] CanvasGroup canvasGroup;
|
|
|
|
bool isDirty;
|
|
|
|
public override void Init()
|
|
{
|
|
isDirty = false;
|
|
|
|
canvasGroup.alpha = 0;
|
|
}
|
|
|
|
public override async UniTask Show()
|
|
{
|
|
isDirty = true;
|
|
|
|
//Tween tween = canvasGroup.DOFade(1, 0.2f);
|
|
|
|
//while (tween != null && tween.active && !tween.IsComplete())
|
|
//{
|
|
// await UniTask.Yield();
|
|
//}
|
|
|
|
canvasGroup.alpha = 1;
|
|
|
|
isDirty = false;
|
|
|
|
canvasGroup.blocksRaycasts = false;
|
|
}
|
|
|
|
public override async UniTask Hide()
|
|
{
|
|
isDirty = true;
|
|
|
|
//Tween tween = canvasGroup.DOFade(0, 0.2f);
|
|
|
|
//while (tween != null && tween.active && !tween.IsComplete())
|
|
//{
|
|
// await UniTask.Yield();
|
|
//}
|
|
|
|
canvasGroup.alpha = 0;
|
|
|
|
isDirty = false;
|
|
|
|
canvasGroup.blocksRaycasts = false;
|
|
}
|
|
|
|
public void Init(Transform parent)
|
|
{
|
|
|
|
}
|
|
|
|
public void Begin()
|
|
{
|
|
UIManager.instance.ShowPanel<LoadingPanel>();
|
|
}
|
|
|
|
public void Finish()
|
|
{
|
|
UIManager.instance.HidePanel<LoadingPanel>();
|
|
}
|
|
|
|
public bool IsDone()
|
|
{
|
|
return !isDirty;
|
|
}
|
|
}
|