update resource manager

重构运行时核心代码
This commit is contained in:
何冠峰
2024-12-24 18:45:37 +08:00
parent 6254d00bb5
commit 4fc0d06908
56 changed files with 610 additions and 1715 deletions
@@ -22,7 +22,7 @@ namespace YooAsset
/// <summary>
/// 资源包文件信息
/// </summary>
public BundleInfo BundleFileInfo { private set; get; }
public BundleInfo LoadBundleInfo { private set; get; }
/// <summary>
/// 是否已经销毁
@@ -47,13 +47,13 @@ namespace YooAsset
/// <summary>
/// 加载结果
/// </summary>
public object Result { set; get; }
public BundleResult Result { set; get; }
internal LoadBundleFileOperation(ResourceManager resourceManager, BundleInfo bundleInfo)
{
_resourceManager = resourceManager;
BundleFileInfo = bundleInfo;
LoadBundleInfo = bundleInfo;
}
internal override void InternalOnStart()
{
@@ -67,7 +67,7 @@ namespace YooAsset
if (_steps == ESteps.LoadFile)
{
if (_loadBundleOp == null)
_loadBundleOp = BundleFileInfo.LoadBundleFile();
_loadBundleOp = LoadBundleInfo.LoadBundleFile();
if (IsWaitForAsyncComplete)
_loadBundleOp.WaitForAsyncComplete();
@@ -83,7 +83,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
Error = $"The bundle loader result is null ! {BundleFileInfo.Bundle.BundleName}";
Error = $"The bundle loader result is null ! {LoadBundleInfo.Bundle.BundleName}";
}
else
{
@@ -137,11 +137,12 @@ namespace YooAsset
// Check fatal
if (RefCount > 0)
throw new Exception($"Bundle file loader ref is not zero : {BundleFileInfo.Bundle.BundleName}");
throw new Exception($"Bundle file loader ref is not zero : {LoadBundleInfo.Bundle.BundleName}");
if (IsDone == false)
throw new Exception($"Bundle file loader is not done : {BundleFileInfo.Bundle.BundleName}");
throw new Exception($"Bundle file loader is not done : {LoadBundleInfo.Bundle.BundleName}");
BundleFileInfo.UnloadBundleFile(Result);
if (Result != null)
Result.UnloadBundleFile();
}
/// <summary>