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.LoadingTime = provider.LoadingTime;
providerInfo.RefCount = provider.RefCount;
providerInfo.Status = (int)provider.Status;
providerInfo.Status = provider.Status.ToString();
providerInfo.DependBundleInfos = new List<DebugBundleInfo>();
result.Add(providerInfo);

View File

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

View File

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

View File

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

View File

@ -48,7 +48,7 @@ namespace YooAsset
if (DependBundleGroup.IsSucceed() == false)
{
Status = EStatus.Fail;
Status = EStatus.Failed;
LastError = DependBundleGroup.GetLastError();
InvokeCompletion();
return;
@ -56,7 +56,7 @@ namespace YooAsset
if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed)
{
Status = EStatus.Fail;
Status = EStatus.Failed;
LastError = OwnerBundle.LastError;
InvokeCompletion();
return;
@ -66,7 +66,7 @@ namespace YooAsset
{
if (OwnerBundle.IsDestroyed)
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 !";
YooLogger.Error(LastError);
InvokeCompletion();
@ -115,8 +115,8 @@ namespace YooAsset
}
}
Status = AssetObject == null ? EStatus.Fail : EStatus.Success;
if (Status == EStatus.Fail)
Status = AssetObject == null ? EStatus.Failed : EStatus.Succeed;
if (Status == EStatus.Failed)
{
if (MainAssetInfo.AssetType == null)
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();
bundleInfo.BundleName = OwnerBundle.MainBundleInfo.Bundle.BundleName;
bundleInfo.RefCount = OwnerBundle.RefCount;
bundleInfo.Status = (int)OwnerBundle.Status;
bundleInfo.Status = OwnerBundle.Status.ToString();
output.Add(bundleInfo);
DependBundleGroup.GetBundleDebugInfos(output);

View File

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

View File

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

View File

@ -48,7 +48,7 @@ namespace YooAsset
if (DependBundleGroup.IsSucceed() == false)
{
Status = EStatus.Fail;
Status = EStatus.Failed;
LastError = DependBundleGroup.GetLastError();
InvokeCompletion();
return;
@ -56,7 +56,7 @@ namespace YooAsset
if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed)
{
Status = EStatus.Fail;
Status = EStatus.Failed;
LastError = OwnerBundle.LastError;
InvokeCompletion();
return;
@ -104,8 +104,8 @@ namespace YooAsset
}
}
Status = AllAssetObjects == null ? EStatus.Fail : EStatus.Success;
if (Status == EStatus.Fail)
Status = AllAssetObjects == null ? EStatus.Failed : EStatus.Succeed;
if (Status == EStatus.Failed)
{
if (MainAssetInfo.AssetType == null)
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)
{
Status = EStatus.Fail;
Status = EStatus.Failed;
LastError = error;
InvokeCompletion();
}

View File

@ -32,7 +32,7 @@ namespace YooAsset
string guid = UnityEditor.AssetDatabase.AssetPathToGUID(MainAssetInfo.AssetPath);
if (string.IsNullOrEmpty(guid))
{
Status = EStatus.Fail;
Status = EStatus.Failed;
LastError = $"Not found asset : {MainAssetInfo.AssetPath}";
YooLogger.Error(LastError);
InvokeCompletion();
@ -59,8 +59,8 @@ namespace YooAsset
// 2. 检测加载结果
if (Status == EStatus.Checking)
{
Status = AssetObject == null ? EStatus.Fail : EStatus.Success;
if (Status == EStatus.Fail)
Status = AssetObject == null ? EStatus.Failed : EStatus.Succeed;
if (Status == EStatus.Failed)
{
if (MainAssetInfo.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);
if (string.IsNullOrEmpty(guid))
{
Status = EStatus.Fail;
Status = EStatus.Failed;
LastError = $"Not found asset : {MainAssetInfo.AssetPath}";
YooLogger.Error(LastError);
InvokeCompletion();
@ -46,7 +46,7 @@ namespace YooAsset
if(Status == EStatus.Checking)
{
RawFilePath = MainAssetInfo.AssetPath;
Status = EStatus.Success;
Status = EStatus.Succeed;
InvokeCompletion();
}
#endif

View File

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

View File

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

View File

@ -13,8 +13,8 @@ namespace YooAsset
CheckBundle,
Loading,
Checking,
Success,
Fail,
Succeed,
Failed,
}
/// <summary>
@ -80,7 +80,7 @@ namespace YooAsset
{
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>
public int Status;
public string Status;
public int CompareTo(DebugBundleInfo other)
{

View File

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