|
|
@@ -1,63 +0,0 @@ |
|
|
|
using System.Collections; |
|
|
|
using System.Threading.Tasks; |
|
|
|
|
|
|
|
using RobocraftX.Schedulers; |
|
|
|
using Svelto.ECS; |
|
|
|
using Svelto.Tasks.ExtraLean; |
|
|
|
using TechbloxModdingAPI.Engines; |
|
|
|
|
|
|
|
namespace TechbloxModdingAPI.Utility |
|
|
|
{ |
|
|
|
public class AsyncUtilsEngine : IApiEngine |
|
|
|
{ |
|
|
|
private IEntityFunctions _efu; |
|
|
|
private IEntityFactory _efa; |
|
|
|
private IEnumerator WaitForSubmissionInternal(IEntityFunctions efu, IEntityFactory efa, |
|
|
|
EntitiesDB entitiesDB, TaskCompletionSource<object> task) |
|
|
|
{ |
|
|
|
/*var waitEnumerator = new WaitForSubmissionEnumerator(efu, efa, entitiesDB); |
|
|
|
while (waitEnumerator.MoveNext()) |
|
|
|
yield return null; |
|
|
|
task.SetResult(null);*/ |
|
|
|
yield break; //TODO |
|
|
|
} |
|
|
|
|
|
|
|
private IEnumerator WaitForNextFrameInternal(TaskCompletionSource<object> task) |
|
|
|
{ |
|
|
|
yield return null; |
|
|
|
task.SetResult(null); |
|
|
|
} |
|
|
|
|
|
|
|
public Task WaitForSubmission() |
|
|
|
{ |
|
|
|
var task = new TaskCompletionSource<object>(); |
|
|
|
WaitForSubmissionInternal(_efu, _efa, entitiesDB, task).RunOn(ExtraLean.EveryFrameStepRunner_TimeStopped); |
|
|
|
return task.Task; |
|
|
|
} |
|
|
|
|
|
|
|
public Task WaitForNextFrame() |
|
|
|
{ |
|
|
|
var task = new TaskCompletionSource<object>(); |
|
|
|
WaitForNextFrameInternal(task).RunOn(ExtraLean.EveryFrameStepRunner_TimeStopped); |
|
|
|
return task.Task; |
|
|
|
} |
|
|
|
|
|
|
|
public void Setup(IEntityFunctions efu, IEntityFactory efa) |
|
|
|
{ |
|
|
|
_efu = efu; |
|
|
|
_efa = efa; |
|
|
|
} |
|
|
|
|
|
|
|
public void Ready() |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public EntitiesDB entitiesDB { get; set; } |
|
|
|
public void Dispose() |
|
|
|
{ |
|
|
|
} |
|
|
|
|
|
|
|
public string Name { get; } = "TechbloxModdingAPIAsyncUtilsGameEngine"; |
|
|
|
public bool isRemovable { get; } = false; |
|
|
|
} |
|
|
|
} |