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.Diagnostics;
using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
@ -158,5 +159,19 @@ namespace YooAsset
private TaskCompletionSource<object> _taskCompletionSource;
#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>
public override void WaitForAsyncComplete()
{
if (_steps == ESteps.Done)
return;
_handle.WaitForAsyncComplete();
InternalOnUpdate();
if (_steps == ESteps.Clone)
{
_handle.WaitForAsyncComplete();
InternalOnUpdate();
DebugCheckWaitForAsyncComplete();
}
}
/// <summary>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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