1
0
Fork 0
LaboratoryProtection/Assets/UnityTest/功能模块/_1模块选择/Scripts/UITestLogic.cs

38 lines
976 B
C#
Raw Permalink Normal View History

2023-09-12 15:55:51 +08:00
using Cysharp.Threading.Tasks;
using Cysharp.Threading.Tasks.Linq;
using PMaker.Await;
using System;
using System.Linq;
using System.Threading;
using UniRx;
using UniRx.Toolkit;
using UnityEngine;
public class UITestLogic : AwaitBehaviour
{
public AwaitBehaviour[] logics;
public UIMultimodule multimodule;
private void Reset()
{
this.logics = GetComponentsInChildren<AwaitBehaviour>(true);
this.multimodule = GetComponentInChildren<UIMultimodule>(true);
}
public override async UniTask WaitAsync(CancellationToken cancellationToken = default)
{
multimodule.gameObject.SetActive(true);
var logics = this.logics.Select(_ => {
var func = new Func<CancellationToken, UniTask>(async token => {
await _.WaitAsync(token);
});
return func;
});
await multimodule.WaitAsync(logics.ToArray(), cancellationToken);
Debug.Log("Over!");
}
}