unpack all; lateupdate taskserializer; create inner context as necessary

This commit is contained in:
Tyfon
2024-07-01 13:54:44 -07:00
parent 3258371a47
commit 214062b1f2
4 changed files with 46 additions and 5 deletions

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnityEngine;
@@ -21,7 +20,7 @@ namespace UIFixes
currentTask = Task.CompletedTask;
totalTask = new TaskCompletionSource();
Update();
LateUpdate();
return totalTask.Task;
}
@@ -29,9 +28,10 @@ namespace UIFixes
public void Cancel()
{
totalTask.TrySetCanceled();
Complete();
}
public void Update()
public void LateUpdate()
{
if (currentTask.IsCanceled)
{
@@ -56,7 +56,7 @@ namespace UIFixes
private void Complete()
{
totalTask.Complete();
totalTask.TryComplete();
func = null;
Destroy(this);
}