Update runtime code

优化调试信息的加载状态显示为文本。
pull/51/head
hevinci 2022-11-26 15:31:35 +08:00
parent fd1edcdedf
commit adf1776b1e
17 changed files with 38 additions and 41 deletions

View File

@ -399,7 +399,7 @@ namespace YooAsset
providerInfo.SpawnTime = provider.SpawnTime; providerInfo.SpawnTime = provider.SpawnTime;
providerInfo.LoadingTime = provider.LoadingTime; providerInfo.LoadingTime = provider.LoadingTime;
providerInfo.RefCount = provider.RefCount; providerInfo.RefCount = provider.RefCount;
providerInfo.Status = (int)provider.Status; providerInfo.Status = provider.Status.ToString();
providerInfo.DependBundleInfos = new List<DebugBundleInfo>(); providerInfo.DependBundleInfos = new List<DebugBundleInfo>();
result.Add(providerInfo); result.Add(providerInfo);

View File

@ -32,9 +32,9 @@ namespace YooAsset
{ {
if (IsValidWithWarning == false) if (IsValidWithWarning == false)
return EOperationStatus.None; return EOperationStatus.None;
if (Provider.Status == ProviderBase.EStatus.Fail) if (Provider.Status == ProviderBase.EStatus.Failed)
return EOperationStatus.Failed; return EOperationStatus.Failed;
else if (Provider.Status == ProviderBase.EStatus.Success) else if (Provider.Status == ProviderBase.EStatus.Succeed)
return EOperationStatus.Succeed; return EOperationStatus.Succeed;
else else
return EOperationStatus.None; return EOperationStatus.None;

View File

@ -104,7 +104,7 @@ namespace YooAsset
var bundleInfo = new DebugBundleInfo(); var bundleInfo = new DebugBundleInfo();
bundleInfo.BundleName = loader.MainBundleInfo.Bundle.BundleName; bundleInfo.BundleName = loader.MainBundleInfo.Bundle.BundleName;
bundleInfo.RefCount = loader.RefCount; bundleInfo.RefCount = loader.RefCount;
bundleInfo.Status = (int)loader.Status; bundleInfo.Status = loader.Status.ToString();
output.Add(bundleInfo); output.Add(bundleInfo);
} }
} }

View File

@ -16,7 +16,6 @@ namespace YooAsset
} }
private ESteps _steps = ESteps.None; private ESteps _steps = ESteps.None;
private bool _isWaitForAsyncComplete = false;
private bool _isShowWaitForAsyncError = false; private bool _isShowWaitForAsyncError = false;
private DownloaderBase _unpacker; private DownloaderBase _unpacker;
private DownloaderBase _downloader; private DownloaderBase _downloader;
@ -136,8 +135,6 @@ namespace YooAsset
/// </summary> /// </summary>
public override void WaitForAsyncComplete() public override void WaitForAsyncComplete()
{ {
_isWaitForAsyncComplete = true;
int frame = 1000; int frame = 1000;
while (true) while (true)
{ {

View File

@ -48,7 +48,7 @@ namespace YooAsset
if (DependBundleGroup.IsSucceed() == false) if (DependBundleGroup.IsSucceed() == false)
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = DependBundleGroup.GetLastError(); LastError = DependBundleGroup.GetLastError();
InvokeCompletion(); InvokeCompletion();
return; return;
@ -56,7 +56,7 @@ namespace YooAsset
if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed) if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed)
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = OwnerBundle.LastError; LastError = OwnerBundle.LastError;
InvokeCompletion(); InvokeCompletion();
return; return;
@ -66,7 +66,7 @@ namespace YooAsset
{ {
if (OwnerBundle.IsDestroyed) if (OwnerBundle.IsDestroyed)
throw new System.Exception("Should never get here !"); throw new System.Exception("Should never get here !");
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = $"The bundle {OwnerBundle.MainBundleInfo.Bundle.BundleName} has been destroyed by unity bugs !"; LastError = $"The bundle {OwnerBundle.MainBundleInfo.Bundle.BundleName} has been destroyed by unity bugs !";
YooLogger.Error(LastError); YooLogger.Error(LastError);
InvokeCompletion(); InvokeCompletion();
@ -115,8 +115,8 @@ namespace YooAsset
} }
} }
Status = AssetObject == null ? EStatus.Fail : EStatus.Success; Status = AssetObject == null ? EStatus.Failed : EStatus.Succeed;
if (Status == EStatus.Fail) if (Status == EStatus.Failed)
{ {
if (MainAssetInfo.AssetType == null) if (MainAssetInfo.AssetType == null)
LastError = $"Failed to load asset : {MainAssetInfo.AssetPath} AssetType : null AssetBundle : {OwnerBundle.MainBundleInfo.Bundle.BundleName}"; LastError = $"Failed to load asset : {MainAssetInfo.AssetPath} AssetType : null AssetBundle : {OwnerBundle.MainBundleInfo.Bundle.BundleName}";

View File

@ -43,7 +43,7 @@ namespace YooAsset
var bundleInfo = new DebugBundleInfo(); var bundleInfo = new DebugBundleInfo();
bundleInfo.BundleName = OwnerBundle.MainBundleInfo.Bundle.BundleName; bundleInfo.BundleName = OwnerBundle.MainBundleInfo.Bundle.BundleName;
bundleInfo.RefCount = OwnerBundle.RefCount; bundleInfo.RefCount = OwnerBundle.RefCount;
bundleInfo.Status = (int)OwnerBundle.Status; bundleInfo.Status = OwnerBundle.Status.ToString();
output.Add(bundleInfo); output.Add(bundleInfo);
DependBundleGroup.GetBundleDebugInfos(output); DependBundleGroup.GetBundleDebugInfos(output);

View File

@ -41,7 +41,7 @@ namespace YooAsset
if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed) if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed)
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = OwnerBundle.LastError; LastError = OwnerBundle.LastError;
InvokeCompletion(); InvokeCompletion();
return; return;
@ -53,7 +53,7 @@ namespace YooAsset
if (Status == EStatus.Checking) if (Status == EStatus.Checking)
{ {
RawFilePath = OwnerBundle.FileLoadPath; RawFilePath = OwnerBundle.FileLoadPath;
Status = EStatus.Success; Status = EStatus.Succeed;
InvokeCompletion(); InvokeCompletion();
} }
} }

View File

@ -52,7 +52,7 @@ namespace YooAsset
if (DependBundleGroup.IsSucceed() == false) if (DependBundleGroup.IsSucceed() == false)
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = DependBundleGroup.GetLastError(); LastError = DependBundleGroup.GetLastError();
InvokeCompletion(); InvokeCompletion();
return; return;
@ -60,7 +60,7 @@ namespace YooAsset
if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed) if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed)
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = OwnerBundle.LastError; LastError = OwnerBundle.LastError;
InvokeCompletion(); InvokeCompletion();
return; return;
@ -83,7 +83,7 @@ namespace YooAsset
} }
else else
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = $"Failed to load scene : {_sceneName}"; LastError = $"Failed to load scene : {_sceneName}";
YooLogger.Error(LastError); YooLogger.Error(LastError);
InvokeCompletion(); InvokeCompletion();
@ -98,8 +98,8 @@ namespace YooAsset
if (SceneObject.IsValid() && _activateOnLoad) if (SceneObject.IsValid() && _activateOnLoad)
SceneManager.SetActiveScene(SceneObject); SceneManager.SetActiveScene(SceneObject);
Status = SceneObject.IsValid() ? EStatus.Success : EStatus.Fail; Status = SceneObject.IsValid() ? EStatus.Succeed : EStatus.Failed;
if (Status == EStatus.Fail) if (Status == EStatus.Failed)
{ {
LastError = $"The load scene is invalid : {MainAssetInfo.AssetPath}"; LastError = $"The load scene is invalid : {MainAssetInfo.AssetPath}";
YooLogger.Error(LastError); YooLogger.Error(LastError);

View File

@ -48,7 +48,7 @@ namespace YooAsset
if (DependBundleGroup.IsSucceed() == false) if (DependBundleGroup.IsSucceed() == false)
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = DependBundleGroup.GetLastError(); LastError = DependBundleGroup.GetLastError();
InvokeCompletion(); InvokeCompletion();
return; return;
@ -56,7 +56,7 @@ namespace YooAsset
if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed) if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed)
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = OwnerBundle.LastError; LastError = OwnerBundle.LastError;
InvokeCompletion(); InvokeCompletion();
return; return;
@ -104,8 +104,8 @@ namespace YooAsset
} }
} }
Status = AllAssetObjects == null ? EStatus.Fail : EStatus.Success; Status = AllAssetObjects == null ? EStatus.Failed : EStatus.Succeed;
if (Status == EStatus.Fail) if (Status == EStatus.Failed)
{ {
if (MainAssetInfo.AssetType == null) if (MainAssetInfo.AssetType == null)
LastError = $"Failed to load sub assets : {MainAssetInfo.AssetPath} AssetType : null AssetBundle : {OwnerBundle.MainBundleInfo.Bundle.BundleName}"; LastError = $"Failed to load sub assets : {MainAssetInfo.AssetPath} AssetType : null AssetBundle : {OwnerBundle.MainBundleInfo.Bundle.BundleName}";

View File

@ -24,7 +24,7 @@ namespace YooAsset
{ {
if (Status == EStatus.None) if (Status == EStatus.None)
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = error; LastError = error;
InvokeCompletion(); InvokeCompletion();
} }

View File

@ -32,7 +32,7 @@ namespace YooAsset
string guid = UnityEditor.AssetDatabase.AssetPathToGUID(MainAssetInfo.AssetPath); string guid = UnityEditor.AssetDatabase.AssetPathToGUID(MainAssetInfo.AssetPath);
if (string.IsNullOrEmpty(guid)) if (string.IsNullOrEmpty(guid))
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = $"Not found asset : {MainAssetInfo.AssetPath}"; LastError = $"Not found asset : {MainAssetInfo.AssetPath}";
YooLogger.Error(LastError); YooLogger.Error(LastError);
InvokeCompletion(); InvokeCompletion();
@ -59,8 +59,8 @@ namespace YooAsset
// 2. 检测加载结果 // 2. 检测加载结果
if (Status == EStatus.Checking) if (Status == EStatus.Checking)
{ {
Status = AssetObject == null ? EStatus.Fail : EStatus.Success; Status = AssetObject == null ? EStatus.Failed : EStatus.Succeed;
if (Status == EStatus.Fail) if (Status == EStatus.Failed)
{ {
if (MainAssetInfo.AssetType == null) if (MainAssetInfo.AssetType == null)
LastError = $"Failed to load asset object : {MainAssetInfo.AssetPath} AssetType : null"; LastError = $"Failed to load asset object : {MainAssetInfo.AssetPath} AssetType : null";

View File

@ -29,7 +29,7 @@ namespace YooAsset
string guid = UnityEditor.AssetDatabase.AssetPathToGUID(MainAssetInfo.AssetPath); string guid = UnityEditor.AssetDatabase.AssetPathToGUID(MainAssetInfo.AssetPath);
if (string.IsNullOrEmpty(guid)) if (string.IsNullOrEmpty(guid))
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = $"Not found asset : {MainAssetInfo.AssetPath}"; LastError = $"Not found asset : {MainAssetInfo.AssetPath}";
YooLogger.Error(LastError); YooLogger.Error(LastError);
InvokeCompletion(); InvokeCompletion();
@ -46,7 +46,7 @@ namespace YooAsset
if(Status == EStatus.Checking) if(Status == EStatus.Checking)
{ {
RawFilePath = MainAssetInfo.AssetPath; RawFilePath = MainAssetInfo.AssetPath;
Status = EStatus.Success; Status = EStatus.Succeed;
InvokeCompletion(); InvokeCompletion();
} }
#endif #endif

View File

@ -51,7 +51,7 @@ namespace YooAsset
} }
else else
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = $"Failed to load scene : {MainAssetInfo.AssetPath}"; LastError = $"Failed to load scene : {MainAssetInfo.AssetPath}";
YooLogger.Error(LastError); YooLogger.Error(LastError);
InvokeCompletion(); InvokeCompletion();
@ -66,8 +66,8 @@ namespace YooAsset
if (SceneObject.IsValid() && _activateOnLoad) if (SceneObject.IsValid() && _activateOnLoad)
SceneManager.SetActiveScene(SceneObject); SceneManager.SetActiveScene(SceneObject);
Status = SceneObject.IsValid() ? EStatus.Success : EStatus.Fail; Status = SceneObject.IsValid() ? EStatus.Succeed : EStatus.Failed;
if (Status == EStatus.Fail) if (Status == EStatus.Failed)
{ {
LastError = $"The loaded scene is invalid : {MainAssetInfo.AssetPath}"; LastError = $"The loaded scene is invalid : {MainAssetInfo.AssetPath}";
YooLogger.Error(LastError); YooLogger.Error(LastError);

View File

@ -32,7 +32,7 @@ namespace YooAsset
string guid = UnityEditor.AssetDatabase.AssetPathToGUID(MainAssetInfo.AssetPath); string guid = UnityEditor.AssetDatabase.AssetPathToGUID(MainAssetInfo.AssetPath);
if (string.IsNullOrEmpty(guid)) if (string.IsNullOrEmpty(guid))
{ {
Status = EStatus.Fail; Status = EStatus.Failed;
LastError = $"Not found asset : {MainAssetInfo.AssetPath}"; LastError = $"Not found asset : {MainAssetInfo.AssetPath}";
YooLogger.Error(LastError); YooLogger.Error(LastError);
InvokeCompletion(); InvokeCompletion();
@ -70,8 +70,8 @@ namespace YooAsset
// 2. 检测加载结果 // 2. 检测加载结果
if (Status == EStatus.Checking) if (Status == EStatus.Checking)
{ {
Status = AllAssetObjects == null ? EStatus.Fail : EStatus.Success; Status = AllAssetObjects == null ? EStatus.Failed : EStatus.Succeed;
if (Status == EStatus.Fail) if (Status == EStatus.Failed)
{ {
if (MainAssetInfo.AssetType == null) if (MainAssetInfo.AssetType == null)
LastError = $"Failed to load sub assets : {MainAssetInfo.AssetPath} AssetType : null"; LastError = $"Failed to load sub assets : {MainAssetInfo.AssetPath} AssetType : null";

View File

@ -13,8 +13,8 @@ namespace YooAsset
CheckBundle, CheckBundle,
Loading, Loading,
Checking, Checking,
Success, Succeed,
Fail, Failed,
} }
/// <summary> /// <summary>
@ -80,7 +80,7 @@ namespace YooAsset
{ {
get get
{ {
return Status == EStatus.Success || Status == EStatus.Fail; return Status == EStatus.Succeed || Status == EStatus.Failed;
} }
} }

View File

@ -25,7 +25,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 加载状态 /// 加载状态
/// </summary> /// </summary>
public int Status; public string Status;
public int CompareTo(DebugBundleInfo other) public int CompareTo(DebugBundleInfo other)
{ {

View File

@ -40,7 +40,7 @@ namespace YooAsset
/// <summary> /// <summary>
/// 加载状态 /// 加载状态
/// </summary> /// </summary>
public int Status; public string Status;
/// <summary> /// <summary>
/// 依赖的资源包列表 /// 依赖的资源包列表