64 lines
No EOL
1.8 KiB
C#
64 lines
No EOL
1.8 KiB
C#
using System.Collections;
|
|
using System.Threading.Tasks;
|
|
|
|
using RobocraftX.Schedulers;
|
|
using Svelto.ECS;
|
|
using Svelto.Tasks.ExtraLean;
|
|
|
|
using GamecraftModdingAPI.Engines;
|
|
|
|
namespace GamecraftModdingAPI.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; } = "GamecraftModdingAPIAsyncUtilsGameEngine";
|
|
public bool isRemovable { get; } = false;
|
|
}
|
|
} |