Update AssetSystem

pull/4/head
hevinci 2022-03-22 20:47:22 +08:00
parent 8373df547b
commit 39c69b1d98
12 changed files with 25 additions and 25 deletions

View File

@ -9,7 +9,7 @@ namespace YooAsset
internal static class AssetSystem
{
private static readonly List<BundleFileLoader> _loaders = new List<BundleFileLoader>(1000);
private static readonly List<AssetProviderBase> _providers = new List<AssetProviderBase>(1000);
private static readonly List<ProviderBase> _providers = new List<ProviderBase>(1000);
/// <summary>
/// 在编辑器下模拟运行
@ -132,7 +132,7 @@ namespace YooAsset
/// </summary>
public static SceneOperationHandle LoadSceneAsync(string scenePath, LoadSceneMode sceneMode, bool activateOnLoad, int priority)
{
AssetProviderBase provider = TryGetAssetProvider(scenePath);
ProviderBase provider = TryGetProvider(scenePath);
if (provider == null)
{
if (SimulationOnEditor)
@ -149,7 +149,7 @@ namespace YooAsset
/// </summary>
public static AssetOperationHandle LoadAssetAsync(string assetPath, System.Type assetType)
{
AssetProviderBase provider = TryGetAssetProvider(assetPath);
ProviderBase provider = TryGetProvider(assetPath);
if (provider == null)
{
if (SimulationOnEditor)
@ -166,7 +166,7 @@ namespace YooAsset
/// </summary>
public static SubAssetsOperationHandle LoadSubAssetsAsync(string assetPath, System.Type assetType)
{
AssetProviderBase provider = TryGetAssetProvider(assetPath);
ProviderBase provider = TryGetProvider(assetPath);
if (provider == null)
{
if (SimulationOnEditor)
@ -200,7 +200,7 @@ namespace YooAsset
}
return result;
}
internal static void RemoveBundleProviders(List<AssetProviderBase> providers)
internal static void RemoveBundleProviders(List<ProviderBase> providers)
{
foreach (var provider in providers)
{
@ -234,12 +234,12 @@ namespace YooAsset
}
return loader;
}
private static AssetProviderBase TryGetAssetProvider(string assetPath)
private static ProviderBase TryGetProvider(string assetPath)
{
AssetProviderBase provider = null;
ProviderBase provider = null;
for (int i = 0; i < _providers.Count; i++)
{
AssetProviderBase temp = _providers[i];
ProviderBase temp = _providers[i];
if (temp.AssetPath.Equals(assetPath))
{
provider = temp;

View File

@ -38,7 +38,7 @@ namespace YooAsset
/// </summary>
public bool IsDestroyed { private set; get; } = false;
private readonly List<AssetProviderBase> _providers = new List<AssetProviderBase>(100);
private readonly List<ProviderBase> _providers = new List<ProviderBase>(100);
private bool _isWaitForAsyncComplete = false;
private bool _isShowWaitForAsyncError = false;
private FileDownloader _fileDownloader;
@ -69,7 +69,7 @@ namespace YooAsset
/// <summary>
/// 添加附属的资源提供者
/// </summary>
public void AddProvider(AssetProviderBase provider)
public void AddProvider(ProviderBase provider)
{
if (_providers.Contains(provider) == false)
_providers.Add(provider);

View File

@ -6,7 +6,7 @@ namespace YooAsset
{
private System.Action<AssetOperationHandle> _callback;
internal AssetOperationHandle(AssetProviderBase provider) : base(provider)
internal AssetOperationHandle(ProviderBase provider) : base(provider)
{
}
internal override void InvokeCallback()

View File

@ -4,9 +4,9 @@ namespace YooAsset
{
public abstract class OperationHandleBase : IEnumerator
{
internal AssetProviderBase _provider { private set; get; }
internal ProviderBase _provider { private set; get; }
internal OperationHandleBase(AssetProviderBase provider)
internal OperationHandleBase(ProviderBase provider)
{
_provider = provider;
}
@ -21,9 +21,9 @@ namespace YooAsset
{
if (IsValid == false)
return EOperationStatus.None;
if (_provider.Status == AssetProviderBase.EStatus.Fail)
if (_provider.Status == ProviderBase.EStatus.Fail)
return EOperationStatus.Failed;
else if (_provider.Status == AssetProviderBase.EStatus.Success)
else if (_provider.Status == ProviderBase.EStatus.Success)
return EOperationStatus.Succeed;
else
return EOperationStatus.None;

View File

@ -111,7 +111,7 @@ namespace YooAsset
private System.Action<SceneOperationHandle> _callback;
internal SceneOperationHandle(AssetProviderBase provider) : base(provider)
internal SceneOperationHandle(ProviderBase provider) : base(provider)
{
}
internal override void InvokeCallback()
@ -189,7 +189,7 @@ namespace YooAsset
return operation;
}
AssetProviderBase provider = _provider;
ProviderBase provider = _provider;
// 释放场景句柄
ReleaseInternal();
@ -222,7 +222,7 @@ namespace YooAsset
}
}
private bool IsAdditiveScene(AssetProviderBase provider)
private bool IsAdditiveScene(ProviderBase provider)
{
if (provider is DatabaseSceneProvider)
{

View File

@ -5,7 +5,7 @@ namespace YooAsset
{
private System.Action<SubAssetsOperationHandle> _callback;
internal SubAssetsOperationHandle(AssetProviderBase provider) : base(provider)
internal SubAssetsOperationHandle(ProviderBase provider) : base(provider)
{
}
internal override void InvokeCallback()

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace YooAsset
{
internal abstract class BundledProvider : AssetProviderBase
internal abstract class BundledProvider : ProviderBase
{
protected BundleFileLoader OwnerBundle { private set; get; }
protected DependBundleGrouper DependBundles { private set; get; }

View File

@ -4,7 +4,7 @@ using UnityEngine;
namespace YooAsset
{
internal sealed class DatabaseAssetProvider : AssetProviderBase
internal sealed class DatabaseAssetProvider : ProviderBase
{
public override float Progress
{

View File

@ -3,7 +3,7 @@ using UnityEngine.SceneManagement;
namespace YooAsset
{
internal sealed class DatabaseSceneProvider : AssetProviderBase
internal sealed class DatabaseSceneProvider : ProviderBase
{
public readonly LoadSceneMode SceneMode;
private readonly bool _activateOnLoad;

View File

@ -4,7 +4,7 @@ using UnityEngine;
namespace YooAsset
{
internal sealed class DatabaseSubAssetsProvider : AssetProviderBase
internal sealed class DatabaseSubAssetsProvider : ProviderBase
{
public override float Progress
{

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
namespace YooAsset
{
internal abstract class AssetProviderBase
internal abstract class ProviderBase
{
public enum EStatus
{
@ -88,7 +88,7 @@ namespace YooAsset
private readonly List<OperationHandleBase> _handles = new List<OperationHandleBase>();
public AssetProviderBase(string assetPath, System.Type assetType)
public ProviderBase(string assetPath, System.Type assetType)
{
AssetPath = assetPath;
AssetName = System.IO.Path.GetFileName(assetPath);