From 39c69b1d9810093b82b1bf00413c968a88f3bd96 Mon Sep 17 00:00:00 2001 From: hevinci Date: Tue, 22 Mar 2022 20:47:22 +0800 Subject: [PATCH] Update AssetSystem --- .../YooAsset/Runtime/AssetSystem/AssetSystem.cs | 16 ++++++++-------- .../AssetSystem/Loader/BundleFileLoader.cs | 4 ++-- .../Operations/AssetOperationHandle.cs | 2 +- .../Operations/OperationHandleBase.cs | 8 ++++---- .../Operations/SceneOperationHandle.cs | 6 +++--- .../Operations/SubAssetsOperationHandle.cs | 2 +- .../AssetSystem/Provider/BundledProvider.cs | 2 +- .../Provider/DatabaseAssetProvider.cs | 2 +- .../Provider/DatabaseSceneProvider.cs | 2 +- .../Provider/DatabaseSubAssetsProvider.cs | 2 +- .../{AssetProviderBase.cs => ProviderBase.cs} | 4 ++-- ...ProviderBase.cs.meta => ProviderBase.cs.meta} | 0 12 files changed, 25 insertions(+), 25 deletions(-) rename Assets/YooAsset/Runtime/AssetSystem/Provider/{AssetProviderBase.cs => ProviderBase.cs} (97%) rename Assets/YooAsset/Runtime/AssetSystem/Provider/{AssetProviderBase.cs.meta => ProviderBase.cs.meta} (100%) diff --git a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs index 6259d92..46f3055 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/AssetSystem.cs @@ -9,7 +9,7 @@ namespace YooAsset internal static class AssetSystem { private static readonly List _loaders = new List(1000); - private static readonly List _providers = new List(1000); + private static readonly List _providers = new List(1000); /// /// 在编辑器下模拟运行 @@ -132,7 +132,7 @@ namespace YooAsset /// 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 /// 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 /// 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 providers) + internal static void RemoveBundleProviders(List 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; diff --git a/Assets/YooAsset/Runtime/AssetSystem/Loader/BundleFileLoader.cs b/Assets/YooAsset/Runtime/AssetSystem/Loader/BundleFileLoader.cs index 8f9d1e4..e61ce10 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Loader/BundleFileLoader.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Loader/BundleFileLoader.cs @@ -38,7 +38,7 @@ namespace YooAsset /// public bool IsDestroyed { private set; get; } = false; - private readonly List _providers = new List(100); + private readonly List _providers = new List(100); private bool _isWaitForAsyncComplete = false; private bool _isShowWaitForAsyncError = false; private FileDownloader _fileDownloader; @@ -69,7 +69,7 @@ namespace YooAsset /// /// 添加附属的资源提供者 /// - public void AddProvider(AssetProviderBase provider) + public void AddProvider(ProviderBase provider) { if (_providers.Contains(provider) == false) _providers.Add(provider); diff --git a/Assets/YooAsset/Runtime/AssetSystem/Operations/AssetOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Operations/AssetOperationHandle.cs index 858a3cd..eabbed6 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Operations/AssetOperationHandle.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Operations/AssetOperationHandle.cs @@ -6,7 +6,7 @@ namespace YooAsset { private System.Action _callback; - internal AssetOperationHandle(AssetProviderBase provider) : base(provider) + internal AssetOperationHandle(ProviderBase provider) : base(provider) { } internal override void InvokeCallback() diff --git a/Assets/YooAsset/Runtime/AssetSystem/Operations/OperationHandleBase.cs b/Assets/YooAsset/Runtime/AssetSystem/Operations/OperationHandleBase.cs index c91edfb..9ead80f 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Operations/OperationHandleBase.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Operations/OperationHandleBase.cs @@ -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; diff --git a/Assets/YooAsset/Runtime/AssetSystem/Operations/SceneOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Operations/SceneOperationHandle.cs index a3102c6..cfe9ae0 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Operations/SceneOperationHandle.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Operations/SceneOperationHandle.cs @@ -111,7 +111,7 @@ namespace YooAsset private System.Action _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) { diff --git a/Assets/YooAsset/Runtime/AssetSystem/Operations/SubAssetsOperationHandle.cs b/Assets/YooAsset/Runtime/AssetSystem/Operations/SubAssetsOperationHandle.cs index 82f30bd..0956310 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Operations/SubAssetsOperationHandle.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Operations/SubAssetsOperationHandle.cs @@ -5,7 +5,7 @@ namespace YooAsset { private System.Action _callback; - internal SubAssetsOperationHandle(AssetProviderBase provider) : base(provider) + internal SubAssetsOperationHandle(ProviderBase provider) : base(provider) { } internal override void InvokeCallback() diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledProvider.cs index 61acf6b..2c6610c 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledProvider.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/BundledProvider.cs @@ -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; } diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseAssetProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseAssetProvider.cs index eab4f90..9dfb1a4 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseAssetProvider.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseAssetProvider.cs @@ -4,7 +4,7 @@ using UnityEngine; namespace YooAsset { - internal sealed class DatabaseAssetProvider : AssetProviderBase + internal sealed class DatabaseAssetProvider : ProviderBase { public override float Progress { diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSceneProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSceneProvider.cs index 51f3007..1112753 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSceneProvider.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSceneProvider.cs @@ -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; diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSubAssetsProvider.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSubAssetsProvider.cs index 18996ce..4bfe499 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSubAssetsProvider.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/DatabaseSubAssetsProvider.cs @@ -4,7 +4,7 @@ using UnityEngine; namespace YooAsset { - internal sealed class DatabaseSubAssetsProvider : AssetProviderBase + internal sealed class DatabaseSubAssetsProvider : ProviderBase { public override float Progress { diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/AssetProviderBase.cs b/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs similarity index 97% rename from Assets/YooAsset/Runtime/AssetSystem/Provider/AssetProviderBase.cs rename to Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs index ebd2233..19f8c07 100644 --- a/Assets/YooAsset/Runtime/AssetSystem/Provider/AssetProviderBase.cs +++ b/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs @@ -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 _handles = new List(); - public AssetProviderBase(string assetPath, System.Type assetType) + public ProviderBase(string assetPath, System.Type assetType) { AssetPath = assetPath; AssetName = System.IO.Path.GetFileName(assetPath); diff --git a/Assets/YooAsset/Runtime/AssetSystem/Provider/AssetProviderBase.cs.meta b/Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs.meta similarity index 100% rename from Assets/YooAsset/Runtime/AssetSystem/Provider/AssetProviderBase.cs.meta rename to Assets/YooAsset/Runtime/AssetSystem/Provider/ProviderBase.cs.meta