Update runtime code

This commit is contained in:
hevinci
2022-09-29 18:40:43 +08:00
parent 46c219505f
commit a71921cdd1
36 changed files with 844 additions and 1625 deletions
@@ -26,7 +26,7 @@ namespace YooAsset
private AssetBundleCreateRequest _createRequest;
public AssetBundleFileLoader(BundleInfo bundleInfo) : base(bundleInfo)
public AssetBundleFileLoader(AssetSystemImpl impl, BundleInfo bundleInfo) : base(impl, bundleInfo)
{
}
@@ -105,13 +105,13 @@ namespace YooAsset
// Load assetBundle file
if (MainBundleInfo.Bundle.IsEncrypted)
{
if (AssetSystem.DecryptionServices == null)
if (Impl.DecryptionServices == null)
throw new Exception($"{nameof(AssetBundleFileLoader)} need {nameof(IDecryptionServices)} : {MainBundleInfo.Bundle.BundleName}");
DecryptionFileInfo fileInfo = new DecryptionFileInfo();
fileInfo.BundleName = MainBundleInfo.Bundle.BundleName;
fileInfo.FileHash = MainBundleInfo.Bundle.FileHash;
ulong offset = AssetSystem.DecryptionServices.GetFileOffset(fileInfo);
ulong offset = Impl.DecryptionServices.GetFileOffset(fileInfo);
if (_isWaitForAsyncComplete)
CacheBundle = AssetBundle.LoadFromFile(_fileLoadPath, 0, offset);
else
@@ -14,6 +14,11 @@ namespace YooAsset
Failed
}
/// <summary>
/// 所属资源系统
/// </summary>
public AssetSystemImpl Impl { private set; get; }
/// <summary>
/// 资源包文件信息
/// </summary>
@@ -43,8 +48,9 @@ namespace YooAsset
internal AssetBundle CacheBundle { set; get; }
public AssetBundleLoaderBase(BundleInfo bundleInfo)
public AssetBundleLoaderBase(AssetSystemImpl impl, BundleInfo bundleInfo)
{
Impl = impl;
MainBundleInfo = bundleInfo;
RefCount = 0;
Status = EStatus.None;
@@ -79,7 +85,7 @@ namespace YooAsset
/// 轮询更新
/// </summary>
public abstract void Update();
/// <summary>
/// 销毁
/// </summary>
@@ -148,7 +154,7 @@ namespace YooAsset
}
// 从列表里移除Providers
AssetSystem.RemoveBundleProviders(_providers);
Impl.RemoveBundleProviders(_providers);
_providers.Clear();
}
@@ -31,7 +31,7 @@ namespace YooAsset
private AssetBundleCreateRequest _createRequest;
public AssetBundleWebLoader(BundleInfo bundleInfo) : base(bundleInfo)
public AssetBundleWebLoader(AssetSystemImpl impl, BundleInfo bundleInfo) : base(impl, bundleInfo)
{
}
@@ -110,13 +110,13 @@ namespace YooAsset
// Load assetBundle file
if (MainBundleInfo.Bundle.IsEncrypted)
{
if (AssetSystem.DecryptionServices == null)
if (Impl.DecryptionServices == null)
throw new Exception($"{nameof(AssetBundleFileLoader)} need {nameof(IDecryptionServices)} : {MainBundleInfo.Bundle.BundleName}");
DecryptionFileInfo fileInfo = new DecryptionFileInfo();
fileInfo.BundleName = MainBundleInfo.Bundle.BundleName;
fileInfo.FileHash = MainBundleInfo.Bundle.FileHash;
ulong offset = AssetSystem.DecryptionServices.GetFileOffset(fileInfo);
ulong offset = Impl.DecryptionServices.GetFileOffset(fileInfo);
_createRequest = AssetBundle.LoadFromFileAsync(_fileLoadPath, 0, offset);
}
else