mirror of
https://github.com/tuyoogame/YooAsset.git
synced 2026-05-22 08:20:18 +00:00
update operation system
异步操作增加执行优先级
This commit is contained in:
@@ -7,24 +7,26 @@ namespace YooAsset
|
||||
internal sealed class BundledAllAssetsProvider : ProviderBase
|
||||
{
|
||||
private AssetBundleRequest _cacheRequest;
|
||||
|
||||
public BundledAllAssetsProvider(ResourceManager manager, string providerGUID, uint providerPriority, AssetInfo assetInfo) : base(manager, providerGUID, providerPriority, assetInfo)
|
||||
|
||||
public BundledAllAssetsProvider(ResourceManager manager, string providerGUID, AssetInfo assetInfo) : base(manager, providerGUID, assetInfo)
|
||||
{
|
||||
}
|
||||
public override void Update()
|
||||
internal override void InternalOnStart()
|
||||
{
|
||||
DebugBeginRecording();
|
||||
|
||||
}
|
||||
internal override void InternalOnUpdate()
|
||||
{
|
||||
if (IsDone)
|
||||
return;
|
||||
|
||||
if (Status == EStatus.None)
|
||||
if (_steps == ESteps.None)
|
||||
{
|
||||
Status = EStatus.CheckBundle;
|
||||
_steps = ESteps.CheckBundle;
|
||||
}
|
||||
|
||||
// 1. 检测资源包
|
||||
if (Status == EStatus.CheckBundle)
|
||||
if (_steps == ESteps.CheckBundle)
|
||||
{
|
||||
if (IsWaitForAsyncComplete)
|
||||
{
|
||||
@@ -39,17 +41,15 @@ namespace YooAsset
|
||||
|
||||
if (DependBundles.IsSucceed() == false)
|
||||
{
|
||||
Status = EStatus.Failed;
|
||||
LastError = DependBundles.GetLastError();
|
||||
InvokeCompletion();
|
||||
string error = DependBundles.GetLastError();
|
||||
InvokeCompletion(error, EOperationStatus.Failed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (OwnerBundle.Status != BundleLoaderBase.EStatus.Succeed)
|
||||
{
|
||||
Status = EStatus.Failed;
|
||||
LastError = OwnerBundle.LastError;
|
||||
InvokeCompletion();
|
||||
string error = OwnerBundle.LastError;
|
||||
InvokeCompletion(error, EOperationStatus.Failed);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -59,11 +59,11 @@ namespace YooAsset
|
||||
return;
|
||||
}
|
||||
|
||||
Status = EStatus.Loading;
|
||||
_steps = ESteps.Loading;
|
||||
}
|
||||
|
||||
// 2. 加载资源对象
|
||||
if (Status == EStatus.Loading)
|
||||
if (_steps == ESteps.Loading)
|
||||
{
|
||||
if (IsWaitForAsyncComplete || IsForceDestroyComplete)
|
||||
{
|
||||
@@ -79,11 +79,11 @@ namespace YooAsset
|
||||
else
|
||||
_cacheRequest = OwnerBundle.CacheBundle.LoadAllAssetsAsync(MainAssetInfo.AssetType);
|
||||
}
|
||||
Status = EStatus.Checking;
|
||||
_steps = ESteps.Checking;
|
||||
}
|
||||
|
||||
// 3. 检测加载结果
|
||||
if (Status == EStatus.Checking)
|
||||
if (_steps == ESteps.Checking)
|
||||
{
|
||||
if (_cacheRequest != null)
|
||||
{
|
||||
@@ -102,16 +102,20 @@ namespace YooAsset
|
||||
}
|
||||
}
|
||||
|
||||
Status = AllAssetObjects == null ? EStatus.Failed : EStatus.Succeed;
|
||||
if (Status == EStatus.Failed)
|
||||
if (AllAssetObjects == null)
|
||||
{
|
||||
string error;
|
||||
if (MainAssetInfo.AssetType == null)
|
||||
LastError = $"Failed to load all assets : {MainAssetInfo.AssetPath} AssetType : null AssetBundle : {OwnerBundle.MainBundleInfo.Bundle.BundleName}";
|
||||
error = $"Failed to load all assets : {MainAssetInfo.AssetPath} AssetType : null AssetBundle : {OwnerBundle.MainBundleInfo.Bundle.BundleName}";
|
||||
else
|
||||
LastError = $"Failed to load all assets : {MainAssetInfo.AssetPath} AssetType : {MainAssetInfo.AssetType} AssetBundle : {OwnerBundle.MainBundleInfo.Bundle.BundleName}";
|
||||
YooLogger.Error(LastError);
|
||||
error = $"Failed to load all assets : {MainAssetInfo.AssetPath} AssetType : {MainAssetInfo.AssetType} AssetBundle : {OwnerBundle.MainBundleInfo.Bundle.BundleName}";
|
||||
YooLogger.Error(error);
|
||||
InvokeCompletion(error, EOperationStatus.Failed);
|
||||
}
|
||||
else
|
||||
{
|
||||
InvokeCompletion(string.Empty, EOperationStatus.Succeed);
|
||||
}
|
||||
InvokeCompletion();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user