update resource manager

pull/326/head
何冠峰 2024-07-07 09:45:01 +08:00
parent b282515c39
commit 25231ecd32
9 changed files with 28 additions and 22 deletions

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Diagnostics;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -158,5 +159,19 @@ namespace YooAsset
private TaskCompletionSource<object> _taskCompletionSource; private TaskCompletionSource<object> _taskCompletionSource;
#endregion #endregion
#region 调试方法
[Conditional("DEBUG")]
protected void DebugCheckWaitForAsyncComplete(string error = null)
{
if (IsDone == false)
{
if (string.IsNullOrEmpty(error))
YooLogger.Error($"Operation {this.GetType().Name} failed to wait for async complete !");
else
YooLogger.Error($"Operation {this.GetType().Name} failed to wait for async complete ! {error}");
}
}
#endregion
} }
} }

View File

@ -77,10 +77,12 @@ namespace YooAsset
/// </summary> /// </summary>
public override void WaitForAsyncComplete() public override void WaitForAsyncComplete()
{ {
if (_steps == ESteps.Done) if (_steps == ESteps.Clone)
return; {
_handle.WaitForAsyncComplete(); _handle.WaitForAsyncComplete();
InternalOnUpdate(); InternalOnUpdate();
DebugCheckWaitForAsyncComplete();
}
} }
/// <summary> /// <summary>

View File

@ -1,5 +1,4 @@
using System; using UnityEngine;
using UnityEngine;
namespace YooAsset namespace YooAsset
{ {
@ -58,5 +57,10 @@ namespace YooAsset
Status = EOperationStatus.Succeed; Status = EOperationStatus.Succeed;
} }
} }
public override void WaitForAsyncComplete()
{
InternalOnUpdate();
DebugCheckWaitForAsyncComplete();
}
} }
} }

View File

@ -42,9 +42,7 @@ namespace YooAsset
if (_steps == ESteps.CheckBundle) if (_steps == ESteps.CheckBundle)
{ {
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
{
FileLoader.WaitForAsyncComplete(); FileLoader.WaitForAsyncComplete();
}
if (FileLoader.IsDone() == false) if (FileLoader.IsDone() == false)
return; return;

View File

@ -42,9 +42,7 @@ namespace YooAsset
if (_steps == ESteps.CheckBundle) if (_steps == ESteps.CheckBundle)
{ {
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
{
FileLoader.WaitForAsyncComplete(); FileLoader.WaitForAsyncComplete();
}
if (FileLoader.IsDone() == false) if (FileLoader.IsDone() == false)
return; return;

View File

@ -39,9 +39,7 @@ namespace YooAsset
if (_steps == ESteps.CheckBundle) if (_steps == ESteps.CheckBundle)
{ {
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
{
FileLoader.WaitForAsyncComplete(); FileLoader.WaitForAsyncComplete();
}
if (FileLoader.IsDone() == false) if (FileLoader.IsDone() == false)
return; return;

View File

@ -37,9 +37,7 @@ namespace YooAsset
if (_steps == ESteps.CheckBundle) if (_steps == ESteps.CheckBundle)
{ {
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
{
FileLoader.WaitForAsyncComplete(); FileLoader.WaitForAsyncComplete();
}
if (FileLoader.IsDone() == false) if (FileLoader.IsDone() == false)
return; return;

View File

@ -42,9 +42,7 @@ namespace YooAsset
if (_steps == ESteps.CheckBundle) if (_steps == ESteps.CheckBundle)
{ {
if (IsWaitForAsyncComplete) if (IsWaitForAsyncComplete)
{
FileLoader.WaitForAsyncComplete(); FileLoader.WaitForAsyncComplete();
}
if (FileLoader.IsDone() == false) if (FileLoader.IsDone() == false)
return; return;

View File

@ -102,12 +102,7 @@ namespace YooAsset
// 注意:主动轮询更新完成同步加载 // 注意:主动轮询更新完成同步加载
InternalOnUpdate(); InternalOnUpdate();
DebugCheckWaitForAsyncComplete($"Loading asset {MainAssetInfo.AssetPath}");
// 验证结果
if (IsDone == false)
{
YooLogger.Warning($"{nameof(WaitForAsyncComplete)} failed to loading : {MainAssetInfo.AssetPath}");
}
} }
/// <summary> /// <summary>