mirror of https://github.com/tuyoogame/YooAsset
update asset system
parent
f24ae6eb2a
commit
561cf411ef
|
@ -4,17 +4,17 @@ using System.Collections.Generic;
|
|||
|
||||
namespace YooAsset
|
||||
{
|
||||
internal class DependAssetBundleGroup
|
||||
internal class DependAssetBundles
|
||||
{
|
||||
/// <summary>
|
||||
/// 依赖的资源包加载器列表
|
||||
/// </summary>
|
||||
internal readonly List<BundleLoaderBase> DependBundles;
|
||||
internal readonly List<BundleLoaderBase> DependList;
|
||||
|
||||
|
||||
public DependAssetBundleGroup(List<BundleLoaderBase> dpendBundles)
|
||||
public DependAssetBundles(List<BundleLoaderBase> dpendList)
|
||||
{
|
||||
DependBundles = dpendBundles;
|
||||
DependList = dpendList;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -22,7 +22,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public bool IsDone()
|
||||
{
|
||||
foreach (var loader in DependBundles)
|
||||
foreach (var loader in DependList)
|
||||
{
|
||||
if (loader.IsDone() == false)
|
||||
return false;
|
||||
|
@ -35,7 +35,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public bool IsSucceed()
|
||||
{
|
||||
foreach (var loader in DependBundles)
|
||||
foreach (var loader in DependList)
|
||||
{
|
||||
if (loader.Status != BundleLoaderBase.EStatus.Succeed)
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public string GetLastError()
|
||||
{
|
||||
foreach (var loader in DependBundles)
|
||||
foreach (var loader in DependList)
|
||||
{
|
||||
if (loader.Status != BundleLoaderBase.EStatus.Succeed)
|
||||
{
|
||||
|
@ -65,7 +65,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public void WaitForAsyncComplete()
|
||||
{
|
||||
foreach (var loader in DependBundles)
|
||||
foreach (var loader in DependList)
|
||||
{
|
||||
if (loader.IsDone() == false)
|
||||
loader.WaitForAsyncComplete();
|
||||
|
@ -77,7 +77,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public void Reference()
|
||||
{
|
||||
foreach (var loader in DependBundles)
|
||||
foreach (var loader in DependList)
|
||||
{
|
||||
loader.Reference();
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
public void Release()
|
||||
{
|
||||
foreach (var loader in DependBundles)
|
||||
foreach (var loader in DependList)
|
||||
{
|
||||
loader.Release();
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ namespace YooAsset
|
|||
/// </summary>
|
||||
internal void GetBundleDebugInfos(List<DebugBundleInfo> output)
|
||||
{
|
||||
foreach (var loader in DependBundles)
|
||||
foreach (var loader in DependList)
|
||||
{
|
||||
var bundleInfo = new DebugBundleInfo();
|
||||
bundleInfo.BundleName = loader.MainBundleInfo.Bundle.BundleName;
|
|
@ -28,19 +28,19 @@ namespace YooAsset
|
|||
{
|
||||
if (IsWaitForAsyncComplete)
|
||||
{
|
||||
DependBundleGroup.WaitForAsyncComplete();
|
||||
DependBundles.WaitForAsyncComplete();
|
||||
OwnerBundle.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
if (DependBundleGroup.IsDone() == false)
|
||||
if (DependBundles.IsDone() == false)
|
||||
return;
|
||||
if (OwnerBundle.IsDone() == false)
|
||||
return;
|
||||
|
||||
if (DependBundleGroup.IsSucceed() == false)
|
||||
if (DependBundles.IsSucceed() == false)
|
||||
{
|
||||
Status = EStatus.Failed;
|
||||
LastError = DependBundleGroup.GetLastError();
|
||||
LastError = DependBundles.GetLastError();
|
||||
InvokeCompletion();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,19 +28,19 @@ namespace YooAsset
|
|||
{
|
||||
if (IsWaitForAsyncComplete)
|
||||
{
|
||||
DependBundleGroup.WaitForAsyncComplete();
|
||||
DependBundles.WaitForAsyncComplete();
|
||||
OwnerBundle.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
if (DependBundleGroup.IsDone() == false)
|
||||
if (DependBundles.IsDone() == false)
|
||||
return;
|
||||
if (OwnerBundle.IsDone() == false)
|
||||
return;
|
||||
|
||||
if (DependBundleGroup.IsSucceed() == false)
|
||||
if (DependBundles.IsSucceed() == false)
|
||||
{
|
||||
Status = EStatus.Failed;
|
||||
LastError = DependBundleGroup.GetLastError();
|
||||
LastError = DependBundles.GetLastError();
|
||||
InvokeCompletion();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -36,15 +36,15 @@ namespace YooAsset
|
|||
// 1. 检测资源包
|
||||
if (Status == EStatus.CheckBundle)
|
||||
{
|
||||
if (DependBundleGroup.IsDone() == false)
|
||||
if (DependBundles.IsDone() == false)
|
||||
return;
|
||||
if (OwnerBundle.IsDone() == false)
|
||||
return;
|
||||
|
||||
if (DependBundleGroup.IsSucceed() == false)
|
||||
if (DependBundles.IsSucceed() == false)
|
||||
{
|
||||
Status = EStatus.Failed;
|
||||
LastError = DependBundleGroup.GetLastError();
|
||||
LastError = DependBundles.GetLastError();
|
||||
InvokeCompletion();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -28,19 +28,19 @@ namespace YooAsset
|
|||
{
|
||||
if (IsWaitForAsyncComplete)
|
||||
{
|
||||
DependBundleGroup.WaitForAsyncComplete();
|
||||
DependBundles.WaitForAsyncComplete();
|
||||
OwnerBundle.WaitForAsyncComplete();
|
||||
}
|
||||
|
||||
if (DependBundleGroup.IsDone() == false)
|
||||
if (DependBundles.IsDone() == false)
|
||||
return;
|
||||
if (OwnerBundle.IsDone() == false)
|
||||
return;
|
||||
|
||||
if (DependBundleGroup.IsSucceed() == false)
|
||||
if (DependBundles.IsSucceed() == false)
|
||||
{
|
||||
Status = EStatus.Failed;
|
||||
LastError = DependBundleGroup.GetLastError();
|
||||
LastError = DependBundles.GetLastError();
|
||||
InvokeCompletion();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ namespace YooAsset
|
|||
|
||||
|
||||
protected BundleLoaderBase OwnerBundle { private set; get; }
|
||||
protected DependAssetBundleGroup DependBundleGroup { private set; get; }
|
||||
protected DependAssetBundles DependBundles { private set; get; }
|
||||
protected bool IsWaitForAsyncComplete { private set; get; } = false;
|
||||
private readonly List<OperationHandleBase> _handles = new List<OperationHandleBase>();
|
||||
|
||||
|
@ -109,9 +109,9 @@ namespace YooAsset
|
|||
OwnerBundle.Reference();
|
||||
OwnerBundle.AddProvider(this);
|
||||
|
||||
var dependBundles = impl.CreateDependAssetBundleLoaders(assetInfo);
|
||||
DependBundleGroup = new DependAssetBundleGroup(dependBundles);
|
||||
DependBundleGroup.Reference();
|
||||
var dependList = impl.CreateDependAssetBundleLoaders(assetInfo);
|
||||
DependBundles = new DependAssetBundles(dependList);
|
||||
DependBundles.Reference();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,10 +133,10 @@ namespace YooAsset
|
|||
OwnerBundle.Release();
|
||||
OwnerBundle = null;
|
||||
}
|
||||
if (DependBundleGroup != null)
|
||||
if (DependBundles != null)
|
||||
{
|
||||
DependBundleGroup.Release();
|
||||
DependBundleGroup = null;
|
||||
DependBundles.Release();
|
||||
DependBundles = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -322,7 +322,7 @@ namespace YooAsset
|
|||
DownloadReport result = new DownloadReport();
|
||||
result.TotalSize = (ulong)OwnerBundle.MainBundleInfo.Bundle.FileSize;
|
||||
result.DownloadedBytes = OwnerBundle.DownloadedBytes;
|
||||
foreach (var dependBundle in DependBundleGroup.DependBundles)
|
||||
foreach (var dependBundle in DependBundles.DependList)
|
||||
{
|
||||
result.TotalSize += (ulong)dependBundle.MainBundleInfo.Bundle.FileSize;
|
||||
result.DownloadedBytes += dependBundle.DownloadedBytes;
|
||||
|
@ -342,7 +342,7 @@ namespace YooAsset
|
|||
bundleInfo.Status = OwnerBundle.Status.ToString();
|
||||
output.Add(bundleInfo);
|
||||
|
||||
DependBundleGroup.GetBundleDebugInfos(output);
|
||||
DependBundles.GetBundleDebugInfos(output);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue