Add load all asset method.

增加新的资源加载方法:加载资源对象所属资源包里的所有资源。
This commit is contained in:
hevinci
2022-05-06 23:15:03 +08:00
parent 65875b66c2
commit afc08d4e46
18 changed files with 605 additions and 112 deletions

View File

@@ -130,7 +130,7 @@ namespace YooAsset
/// <summary>
/// 异步加载场景
/// 加载场景
/// </summary>
public static SceneOperationHandle LoadSceneAsync(string scenePath, LoadSceneMode sceneMode, bool activateOnLoad, int priority)
{
@@ -161,7 +161,7 @@ namespace YooAsset
}
/// <summary>
/// 异步加载资源对象
/// 加载资源对象
/// </summary>
public static AssetOperationHandle LoadAssetAsync(string assetPath, System.Type assetType)
{
@@ -179,7 +179,7 @@ namespace YooAsset
}
/// <summary>
/// 异步加载所有子资源对象
/// 加载子资源对象
/// </summary>
public static SubAssetsOperationHandle LoadSubAssetsAsync(string assetPath, System.Type assetType)
{
@@ -196,6 +196,24 @@ namespace YooAsset
return provider.CreateHandle() as SubAssetsOperationHandle;
}
/// <summary>
/// 加载资源包里的所有资源对象
/// </summary>
public static AllAssetsOperationHandle LoadAllAssetsAsync(string assetPath, System.Type assetType)
{
ProviderBase provider = TryGetProvider(assetPath);
if (provider == null)
{
if (SimulationOnEditor)
provider = new DatabaseAllAssetsProvider(assetPath, assetType);
else
provider = new BundledAllAssetsProvider(assetPath, assetType);
provider.InitSpawnDebugInfo();
_providers.Add(provider);
}
return provider.CreateHandle() as AllAssetsOperationHandle;
}
internal static void UnloadSubScene(ProviderBase provider)
{