mirror of https://github.com/tuyoogame/YooAsset
parent
9b4abf86b6
commit
ab2d7d4724
|
@ -44,12 +44,16 @@ namespace YooAsset
|
||||||
{
|
{
|
||||||
if (IsValidWithWarning == false)
|
if (IsValidWithWarning == false)
|
||||||
return EOperationStatus.None;
|
return EOperationStatus.None;
|
||||||
if (Provider.Status == ProviderBase.EStatus.Failed)
|
|
||||||
return EOperationStatus.Failed;
|
var status = Provider.Status;
|
||||||
else if (Provider.Status == ProviderBase.EStatus.Succeed)
|
if (status == ProviderBase.EStatus.None)
|
||||||
return EOperationStatus.Succeed;
|
|
||||||
else
|
|
||||||
return EOperationStatus.None;
|
return EOperationStatus.None;
|
||||||
|
else if (status == ProviderBase.EStatus.Succeed)
|
||||||
|
return EOperationStatus.Succeed;
|
||||||
|
else if (status == ProviderBase.EStatus.Failed)
|
||||||
|
return EOperationStatus.Failed;
|
||||||
|
else
|
||||||
|
return EOperationStatus.Processing;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,13 +73,18 @@ namespace YooAsset
|
||||||
|
|
||||||
internal abstract void Start();
|
internal abstract void Start();
|
||||||
internal abstract void Update();
|
internal abstract void Update();
|
||||||
internal void Finish()
|
|
||||||
|
internal void OnFinish()
|
||||||
{
|
{
|
||||||
Progress = 1f;
|
Progress = 1f;
|
||||||
_callback?.Invoke(this);
|
_callback?.Invoke(this);
|
||||||
if (_taskCompletionSource != null)
|
if (_taskCompletionSource != null)
|
||||||
_taskCompletionSource.TrySetResult(null);
|
_taskCompletionSource.TrySetResult(null);
|
||||||
}
|
}
|
||||||
|
internal void OnStart()
|
||||||
|
{
|
||||||
|
Status = EOperationStatus.Processing;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 清空完成回调
|
/// 清空完成回调
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace YooAsset
|
||||||
public enum EOperationStatus
|
public enum EOperationStatus
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
|
Processing,
|
||||||
Succeed,
|
Succeed,
|
||||||
Failed
|
Failed
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace YooAsset
|
||||||
if (operation.IsDone)
|
if (operation.IsDone)
|
||||||
{
|
{
|
||||||
_removeList.Add(operation);
|
_removeList.Add(operation);
|
||||||
operation.Finish();
|
operation.OnFinish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,7 @@ namespace YooAsset
|
||||||
public static void StartOperation(AsyncOperationBase operation)
|
public static void StartOperation(AsyncOperationBase operation)
|
||||||
{
|
{
|
||||||
_addList.Add(operation);
|
_addList.Add(operation);
|
||||||
|
operation.OnStart();
|
||||||
operation.Start();
|
operation.Start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue