LaboratoryProtection/Assets/PMaker/Scripts/Await/UI/UIDefault.cs

29 lines
674 B
C#

using Cysharp.Threading.Tasks;
using System.Threading;
using UnityEngine;
using UnityEngine.UI;
namespace PMaker.Await.UI
{
public class UIDefault : AwaitBehaviour
{
[SerializeField]
private Button _btn;
private void Reset()
{
_btn = this.GetComponentInChildren<Button>(true);
}
public override async UniTask WaitAsync(CancellationToken cancellationToken = default)
{
this.SetFalse();
this.gameObject.SetActive(true);
await _btn.OnClickAsync(cancellationToken).SuppressCancellationThrow();
this.gameObject.SetActive(false);
}
}
}