LaboratoryProtection/Assets/UnityTest/UI/Scripts/Message/UINextBtn.cs

42 lines
982 B
C#

using Cysharp.Threading.Tasks;
using PMaker.MessagePipe;
using System.Threading;
using UnityEngine;
using UnityEngine.UI;
public class UINextBtn : NameMessageBehaviour<string>
{
//public float duration = 0f;
[SerializeField]
private Transform _root;
//[SerializeField]
//private TextMeshProUGUI[] _text;
[SerializeField]
private Button _nextBtn;
private void Reset()
{
this._root = this.transform.Find("Root");
this._nextBtn = this.GetComponentInChildren<Button>(true);
}
private void Start()
{
//var key = true;
this.asyncHandler =
async (string message, CancellationToken cancellationToken) => {
//key = false;
this._root.gameObject.SetActive(true);
await _nextBtn.OnClickAsync(cancellationToken).SuppressCancellationThrow();
this._root.gameObject.SetActive(false);
//key = true;
};
}
}