Update AssetSystem

This commit is contained in:
hevinci
2022-03-23 12:44:56 +08:00
parent 3e8b8123e1
commit 829b4fca76
17 changed files with 265 additions and 129 deletions

View File

@@ -53,9 +53,10 @@ namespace YooAsset
internal void Finish()
{
_callback?.Invoke(this);
_waitHandle?.Set();
}
#region
#region
public bool MoveNext()
{
return !IsDone;
@@ -64,6 +65,29 @@ namespace YooAsset
{
}
public object Current => null;
private System.Threading.EventWaitHandle _waitHandle;
private System.Threading.WaitHandle WaitHandle
{
get
{
if (_waitHandle == null)
_waitHandle = new System.Threading.EventWaitHandle(false, System.Threading.EventResetMode.ManualReset);
_waitHandle.Reset();
return _waitHandle;
}
}
public System.Threading.Tasks.Task Task
{
get
{
var handle = WaitHandle;
return System.Threading.Tasks.Task.Factory.StartNew(o =>
{
handle.WaitOne();
}, this);
}
}
#endregion
}
}