diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs
index 4930d7df..965f952c 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/AssetBundleSimulateBuilder.cs
@@ -19,7 +19,7 @@ namespace YooAsset.Editor
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = EBuildPipeline.EditorSimulateBuildPipeline.ToString();
- buildParameters.BuildBundleType = (int)EBuildBundleType.VirtualBundle;
+ buildParameters.BuildBundleType = (int)EBundleType.VirtualBundle;
buildParameters.BuildTarget = EditorUserBuildSettings.activeBuildTarget;
buildParameters.PackageName = packageName;
buildParameters.PackageVersion = "Simulate";
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
index 95db7e3c..673567d3 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildParameters.cs
@@ -96,7 +96,7 @@ namespace YooAsset.Editor
///
/// 资源包加密服务类
///
- public IEncryptionServices EncryptionServices;
+ public IBundleEncryptionServices EncryptionServices;
///
/// 资源清单加密服务类
@@ -146,7 +146,7 @@ namespace YooAsset.Editor
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildPipelineIsNullOrEmpty, "Build pipeline is null or empty !");
throw new Exception(message);
}
- if (BuildBundleType == (int)EBuildBundleType.Unknown)
+ if (BuildBundleType == (int)EBundleType.Unknown)
{
string message = BuildLogger.GetErrorMessage(ErrorCode.BuildBundleTypeIsUnknown, $"Build bundle type is unknown {BuildBundleType} !");
throw new Exception(message);
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs
index e408a20e..6ff76767 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs
@@ -15,7 +15,7 @@ namespace YooAsset.Editor
string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
string buildPackageName = buildParametersContext.Parameters.PackageName;
var manifestServices = buildParametersContext.Parameters.ManifestRestoreServices;
- CatalogTools.CreateCatalogFile(manifestServices, buildPackageName, buildinRootDirectory);
+ CatalogFileHelper.CreateFile(manifestServices, buildPackageName, buildinRootDirectory);
// 刷新目录
AssetDatabase.Refresh();
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
index af912fd6..eb00708b 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
@@ -31,7 +31,7 @@ namespace YooAsset.Editor
// 创建新补丁清单
PackageManifest manifest = new PackageManifest();
- manifest.FileVersion = ManifestDefine.FileVersion;
+ manifest.FileVersion = PackageManifestDefine.FileVersion;
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
manifest.SupportExtensionless = buildMapContext.Command.SupportExtensionless;
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
@@ -71,7 +71,7 @@ namespace YooAsset.Editor
{
string fileName = YooAssetSettingsData.GetManifestJsonFileName(buildParameters.PackageName, buildParameters.PackageVersion);
string filePath = $"{packageOutputDirectory}/{fileName}";
- ManifestTools.SerializeToJson(filePath, manifest);
+ PackageManifestTools.SerializeToJson(filePath, manifest);
BuildLogger.Log($"Create package manifest file: {filePath}");
}
@@ -81,7 +81,7 @@ namespace YooAsset.Editor
{
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(buildParameters.PackageName, buildParameters.PackageVersion);
packagePath = $"{packageOutputDirectory}/{fileName}";
- ManifestTools.SerializeToBinary(packagePath, manifest, buildParameters.ManifestProcessServices);
+ PackageManifestTools.SerializeToBinary(packagePath, manifest, buildParameters.ManifestProcessServices);
packageHash = HashUtility.FileCRC32(packagePath);
BuildLogger.Log($"Create package manifest file: {packagePath}");
}
@@ -106,7 +106,7 @@ namespace YooAsset.Editor
{
ManifestContext manifestContext = new ManifestContext();
byte[] bytesData = FileUtility.ReadAllBytes(packagePath);
- manifestContext.Manifest = ManifestTools.DeserializeFromBinary(bytesData, buildParameters.ManifestRestoreServices);
+ manifestContext.Manifest = PackageManifestTools.DeserializeFromBinary(bytesData, buildParameters.ManifestRestoreServices);
context.SetContextObject(manifestContext);
}
}
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskEncryption.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskEncryption.cs
index 7e9369d7..bfe2dffc 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskEncryption.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskEncryption.cs
@@ -24,7 +24,7 @@ namespace YooAsset.Editor
string pipelineOutputDirectory = buildParametersContext.GetPipelineOutputDirectory();
foreach (var bundleInfo in buildMapContext.Collection)
{
- EncryptFileInfo fileInfo = new EncryptFileInfo();
+ EncryptBundleInfo fileInfo = new EncryptBundleInfo();
fileInfo.BundleName = bundleInfo.BundleName;
fileInfo.FileLoadPath = $"{pipelineOutputDirectory}/{bundleInfo.BundleName}";
var encryptResult = encryptionServices.Encrypt(fileInfo);
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskUpdateBundleInfo.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskUpdateBundleInfo.cs
index e9654680..1d6ea1a8 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskUpdateBundleInfo.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskUpdateBundleInfo.cs
@@ -54,8 +54,8 @@ namespace YooAsset.Editor
{
string bundleName = bundleInfo.BundleName;
string fileHash = bundleInfo.PackageFileHash;
- string fileExtension = ManifestTools.GetRemoteBundleFileExtension(bundleName);
- string fileName = ManifestTools.GetRemoteBundleFileName(outputNameStyle, bundleName, fileExtension, fileHash);
+ string fileExtension = PackageManifestTools.GetRemoteBundleFileExtension(bundleName);
+ string fileName = PackageManifestTools.GetRemoteBundleFileName(outputNameStyle, bundleName, fileExtension, fileHash);
bundleInfo.PackageDestFilePath = $"{packageOutputDirectory}/{fileName}";
}
}
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/DefaultEncryptionServices.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/DefaultEncryptionServices.cs
index 8cdb2b10..871d8738 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/DefaultEncryptionServices.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/DefaultEncryptionServices.cs
@@ -1,9 +1,9 @@
namespace YooAsset.Editor
{
- public class EncryptionNone : IEncryptionServices
+ public class EncryptionNone : IBundleEncryptionServices
{
- public EncryptResult Encrypt(EncryptFileInfo fileInfo)
+ public EncryptResult Encrypt(EncryptBundleInfo fileInfo)
{
throw new System.NotImplementedException();
}
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.cs
index 4b65e3b5..3c105b00 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuildPipelineViewerBase.cs
@@ -46,13 +46,13 @@ namespace YooAsset.Editor
///
/// 创建资源包加密服务类实例
///
- protected IEncryptionServices CreateEncryptionServicesInstance()
+ protected IBundleEncryptionServices CreateEncryptionServicesInstance()
{
var className = AssetBundleBuilderSetting.GetPackageEncyptionServicesClassName(PackageName, PipelineName);
- var classTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
+ var classTypes = EditorTools.GetAssignableTypes(typeof(IBundleEncryptionServices));
var classType = classTypes.Find(x => x.FullName.Equals(className));
if (classType != null)
- return (IEncryptionServices)Activator.CreateInstance(classType);
+ return (IBundleEncryptionServices)Activator.CreateInstance(classType);
else
return null;
}
@@ -184,7 +184,7 @@ namespace YooAsset.Editor
protected PopupField CreateEncryptionServicesField(VisualElement container)
{
// 资源包加密服务类
- var classTypes = EditorTools.GetAssignableTypes(typeof(IEncryptionServices));
+ var classTypes = EditorTools.GetAssignableTypes(typeof(IBundleEncryptionServices));
if (classTypes.Count > 0)
{
var className = AssetBundleBuilderSetting.GetPackageEncyptionServicesClassName(PackageName, PipelineName);
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuiltinBuildPipeline/BuiltinBuildPipelineViewer.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuiltinBuildPipeline/BuiltinBuildPipelineViewer.cs
index 48fcc692..62a447f8 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuiltinBuildPipeline/BuiltinBuildPipelineViewer.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/BuiltinBuildPipeline/BuiltinBuildPipelineViewer.cs
@@ -109,7 +109,7 @@ namespace YooAsset.Editor
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = PipelineName.ToString();
- buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
+ buildParameters.BuildBundleType = (int)EBundleType.AssetBundle;
buildParameters.BuildTarget = BuildTarget;
buildParameters.PackageName = PackageName;
buildParameters.PackageVersion = _buildVersionField.value;
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/EditorSimulateBuildpipeline/EditorSimulateBuildPipelineViewer.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/EditorSimulateBuildpipeline/EditorSimulateBuildPipelineViewer.cs
index be1dbd13..7e2ea295 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/EditorSimulateBuildpipeline/EditorSimulateBuildPipelineViewer.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/EditorSimulateBuildpipeline/EditorSimulateBuildPipelineViewer.cs
@@ -66,7 +66,7 @@ namespace YooAsset.Editor
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = PipelineName.ToString();
- buildParameters.BuildBundleType = (int)EBuildBundleType.VirtualBundle;
+ buildParameters.BuildBundleType = (int)EBundleType.VirtualBundle;
buildParameters.BuildTarget = BuildTarget;
buildParameters.PackageName = PackageName;
buildParameters.PackageVersion = _buildVersionField.value;
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/RawfileBuildpipeline/RawfileBuildPipelineViewer.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/RawfileBuildpipeline/RawfileBuildPipelineViewer.cs
index af06e30d..dd78c58d 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/RawfileBuildpipeline/RawfileBuildPipelineViewer.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/RawfileBuildpipeline/RawfileBuildPipelineViewer.cs
@@ -103,7 +103,7 @@ namespace YooAsset.Editor
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = PipelineName.ToString();
- buildParameters.BuildBundleType = (int)EBuildBundleType.RawBundle;
+ buildParameters.BuildBundleType = (int)EBundleType.RawBundle;
buildParameters.BuildTarget = BuildTarget;
buildParameters.PackageName = PackageName;
buildParameters.PackageVersion = _buildVersionField.value;
diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/ScriptableBuildPipeline/ScriptableBuildPipelineViewer.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/ScriptableBuildPipeline/ScriptableBuildPipelineViewer.cs
index 0ca3183f..e3be3b05 100644
--- a/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/ScriptableBuildPipeline/ScriptableBuildPipelineViewer.cs
+++ b/Assets/YooAsset/Editor/AssetBundleBuilder/VisualViewers/ScriptableBuildPipeline/ScriptableBuildPipelineViewer.cs
@@ -109,7 +109,7 @@ namespace YooAsset.Editor
buildParameters.BuildOutputRoot = AssetBundleBuilderHelper.GetDefaultBuildOutputRoot();
buildParameters.BuildinFileRoot = AssetBundleBuilderHelper.GetStreamingAssetsRoot();
buildParameters.BuildPipeline = PipelineName.ToString();
- buildParameters.BuildBundleType = (int)EBuildBundleType.AssetBundle;
+ buildParameters.BuildBundleType = (int)EBundleType.AssetBundle;
buildParameters.BuildTarget = BuildTarget;
buildParameters.PackageName = PackageName;
buildParameters.PackageVersion = _buildVersionField.value;
diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs
index 14c2f357..e9f11021 100644
--- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs
+++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterAssetListViewer.cs
@@ -277,7 +277,7 @@ namespace YooAsset.Editor
if (dependTableData.BundleInfo.Encrypted)
return;
- if (_buildReport.Summary.BuildBundleType == (int)EBuildBundleType.AssetBundle)
+ if (_buildReport.Summary.BuildBundleType == (int)EBundleType.AssetBundle)
{
string rootDirectory = Path.GetDirectoryName(_reportFilePath);
string filePath = $"{rootDirectory}/{dependTableData.BundleInfo.FileName}";
diff --git a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs
index 18e77769..405533d9 100644
--- a/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs
+++ b/Assets/YooAsset/Editor/AssetBundleReporter/VisualViewers/ReporterBundleListViewer.cs
@@ -348,7 +348,7 @@ namespace YooAsset.Editor
if (bundleTableData.BundleInfo.Encrypted)
return;
- if (_buildReport.Summary.BuildBundleType == (int)EBuildBundleType.AssetBundle)
+ if (_buildReport.Summary.BuildBundleType == (int)EBundleType.AssetBundle)
{
string rootDirectory = Path.GetDirectoryName(_reportFilePath);
string filePath = $"{rootDirectory}/{bundleTableData.BundleInfo.FileName}";
diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemDefine.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemDefine.cs
index e693d1bc..91db0b56 100644
--- a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemDefine.cs
+++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemDefine.cs
@@ -3,9 +3,9 @@ using System.Collections.Generic;
namespace YooAsset
{
///
- /// 导入文件的信息
+ /// 导入的资源包信息
///
- public struct ImportFileInfo
+ public struct ImportBundleInfo
{
///
/// 本地文件路径
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileDefine.cs
similarity index 91%
rename from Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs
rename to Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileDefine.cs
index 918e7718..f4b43dee 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileDefine.cs
@@ -1,7 +1,7 @@
namespace YooAsset
{
- internal class CatalogDefine
+ internal class CatalogFileDefine
{
///
/// 文件极限大小(100MB)
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs.meta b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileDefine.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileDefine.cs.meta
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileHelper.cs
similarity index 91%
rename from Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs
rename to Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileHelper.cs
index 446c2ee1..1dcb0ae1 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileHelper.cs
@@ -5,14 +5,14 @@ using UnityEngine;
namespace YooAsset
{
- internal static class CatalogTools
+ internal static class CatalogFileHelper
{
#if UNITY_EDITOR
///
/// 生成包裹的内置资源目录文件
/// 说明:根据指定目录下的文件生成清单文件。
///
- public static bool CreateCatalogFile(IManifestRestoreServices services, string packageName, string packageDirectory)
+ public static bool CreateFile(IManifestRestoreServices services, string packageName, string packageDirectory)
{
// 获取资源清单版本
string packageVersion;
@@ -40,7 +40,7 @@ namespace YooAsset
}
var binaryData = FileUtility.ReadAllBytes(manifestFilePath);
- packageManifest = ManifestTools.DeserializeFromBinary(binaryData, services);
+ packageManifest = PackageManifestTools.DeserializeFromBinary(binaryData, services);
}
// 获取文件名映射关系
@@ -54,7 +54,7 @@ namespace YooAsset
// 创建内置清单实例
var buildinFileCatalog = new DefaultBuildinFileCatalog();
- buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
+ buildinFileCatalog.FileVersion = CatalogFileDefine.FileVersion;
buildinFileCatalog.PackageName = packageName;
buildinFileCatalog.PackageVersion = packageVersion;
@@ -122,11 +122,11 @@ namespace YooAsset
///
/// 生成空的包裹内置资源目录文件
///
- public static bool CreateEmptyCatalogFile(string packageName, string packageVersion, string outputPath)
+ public static bool CreateEmptyFile(string packageName, string packageVersion, string outputPath)
{
// 创建内置清单实例
var buildinFileCatalog = new DefaultBuildinFileCatalog();
- buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
+ buildinFileCatalog.FileVersion = CatalogFileDefine.FileVersion;
buildinFileCatalog.PackageName = packageName;
buildinFileCatalog.PackageVersion = packageVersion;
@@ -173,13 +173,13 @@ namespace YooAsset
using (FileStream fs = new FileStream(savePath, FileMode.Create))
{
// 创建缓存器
- BufferWriter buffer = new BufferWriter(CatalogDefine.FileMaxSize);
+ BufferWriter buffer = new BufferWriter(CatalogFileDefine.FileMaxSize);
// 写入文件标记
- buffer.WriteUInt32(CatalogDefine.FileSign);
+ buffer.WriteUInt32(CatalogFileDefine.FileSign);
// 写入文件版本
- buffer.WriteUTF8(CatalogDefine.FileVersion);
+ buffer.WriteUTF8(CatalogFileDefine.FileVersion);
// 写入文件头信息
buffer.WriteUTF8(catalog.PackageName);
@@ -213,13 +213,13 @@ namespace YooAsset
// 读取文件标记
uint fileSign = buffer.ReadUInt32();
- if (fileSign != CatalogDefine.FileSign)
+ if (fileSign != CatalogFileDefine.FileSign)
throw new Exception("Invalid catalog file !");
// 读取文件版本
string fileVersion = buffer.ReadUTF8();
- if (fileVersion != CatalogDefine.FileVersion)
- throw new Exception($"The catalog file version are not compatible : {fileVersion} != {CatalogDefine.FileVersion}");
+ if (fileVersion != CatalogFileDefine.FileVersion)
+ throw new Exception($"The catalog file version are not compatible : {fileVersion} != {CatalogFileDefine.FileVersion}");
DefaultBuildinFileCatalog catalog = new DefaultBuildinFileCatalog();
{
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs.meta b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileHelper.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogFileHelper.cs.meta
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
index ed351652..a62147f0 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
@@ -107,12 +107,12 @@ namespace YooAsset
///
/// 自定义参数:解密服务接口的实例类
///
- public IDecryptionServices DecryptionServices { private set; get; }
+ public IBundleDecryptionServices BundleDecryptionServices { private set; get; }
///
/// 自定义参数:资源清单服务类
///
- public IManifestRestoreServices ManifestServices { private set; get; }
+ public IManifestRestoreServices ManifestRestoreServices { private set; get; }
///
/// 自定义参数:拷贝内置文件接口的实例类
@@ -139,29 +139,30 @@ namespace YooAsset
var operation = new DBFSLoadPackageManifestOperation(this, options.PackageVersion);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options)
{
- return _unpackFileSystem.ClearCacheFilesAsync(manifest, options);
+ return _unpackFileSystem.ClearCacheFilesAsync(options);
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
+ public virtual FSDownloadFileOperation DownloadFileAsync(DownloadFileOptions options)
{
// 注意:业务层的解压器会依赖该方法
- options.ImportFilePath = GetBuildinFileLoadPath(bundle);
- return _unpackFileSystem.DownloadFileAsync(bundle, options);
+ options.ImportFilePath = GetBuildinFileLoadPath(options.Bundle);
+ return _unpackFileSystem.DownloadFileAsync(options);
}
- public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
+ public virtual FSLoadBundleOperation LoadBundleAsync(LoadBundleOptions options)
{
+ PackageBundle bundle = options.Bundle;
if (IsUnpackBundleFile(bundle))
{
- return _unpackFileSystem.LoadBundleFile(bundle);
+ return _unpackFileSystem.LoadBundleAsync(options);
}
- if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
+ if (bundle.BundleType == (int)EBundleType.AssetBundle)
{
var operation = new DBFSLoadAssetBundleOperation(this, bundle);
return operation;
}
- else if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
+ else if (bundle.BundleType == (int)EBundleType.RawBundle)
{
var operation = new DBFSLoadRawBundleOperation(this, bundle);
return operation;
@@ -224,13 +225,13 @@ namespace YooAsset
{
UnpackFileSystemRoot = (string)value;
}
- else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
+ else if (name == FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES)
{
- DecryptionServices = (IDecryptionServices)value;
+ BundleDecryptionServices = (IBundleDecryptionServices)value;
}
- else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
+ else if (name == FileSystemParametersDefine.MANIFEST_RESTORE_SERVICES)
{
- ManifestServices = (IManifestRestoreServices)value;
+ ManifestRestoreServices = (IManifestRestoreServices)value;
}
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
{
@@ -264,7 +265,7 @@ namespace YooAsset
_unpackFileSystem.SetParameter(FileSystemParametersDefine.FILE_VERIFY_LEVEL, FileVerifyLevel);
_unpackFileSystem.SetParameter(FileSystemParametersDefine.FILE_VERIFY_MAX_CONCURRENCY, FileVerifyMaxConcurrency);
_unpackFileSystem.SetParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, AppendFileExtension);
- _unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices);
+ _unpackFileSystem.SetParameter(FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES, BundleDecryptionServices);
_unpackFileSystem.SetParameter(FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES, CopyLocalFileServices);
_unpackFileSystem.OnCreate(packageName, UnpackFileSystemRoot);
}
@@ -409,7 +410,7 @@ namespace YooAsset
if (bundle.Encrypted)
return true;
- if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
+ if (bundle.BundleType == (int)EBundleType.RawBundle)
return true;
return false;
@@ -479,31 +480,31 @@ namespace YooAsset
///
/// 加载加密的资源文件
///
- public DecryptResult LoadEncryptedAssetBundle(PackageBundle bundle)
+ public DecryptSyncResult LoadEncryptedBundleSync(PackageBundle bundle)
{
string filePath = GetBuildinFileLoadPath(bundle);
- var fileInfo = new DecryptFileInfo()
+ var bundleInfo = new DecryptBundleInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
- return DecryptionServices.LoadAssetBundle(fileInfo);
+ return BundleDecryptionServices.LoadAssetBundleSync(bundleInfo);
}
///
/// 加载加密的资源文件
///
- public DecryptResult LoadEncryptedAssetBundleAsync(PackageBundle bundle)
+ public DecryptAsyncResult LoadEncryptedBundleAsync(PackageBundle bundle)
{
string filePath = GetBuildinFileLoadPath(bundle);
- var fileInfo = new DecryptFileInfo()
+ var bundleInfo = new DecryptBundleInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
- return DecryptionServices.LoadAssetBundleAsync(fileInfo);
+ return BundleDecryptionServices.LoadAssetBundleAsync(bundleInfo);
}
#endregion
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
index db943918..7a9a67f5 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
@@ -44,11 +44,11 @@ namespace YooAsset
{
if (_bundle.Encrypted)
{
- if (_fileSystem.DecryptionServices == null)
+ if (_fileSystem.BundleDecryptionServices == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = $"The {nameof(IDecryptionServices)} is null !";
+ Error = $"The {nameof(IBundleDecryptionServices)} is null !";
YooLogger.Error(Error);
return;
}
@@ -58,7 +58,7 @@ namespace YooAsset
{
if (_bundle.Encrypted)
{
- var decryptResult = _fileSystem.LoadEncryptedAssetBundle(_bundle);
+ var decryptResult = _fileSystem.LoadEncryptedBundleSync(_bundle);
_assetBundle = decryptResult.Result;
_managedStream = decryptResult.ManagedStream;
}
@@ -72,7 +72,7 @@ namespace YooAsset
{
if (_bundle.Encrypted)
{
- var decryptResult = _fileSystem.LoadEncryptedAssetBundleAsync(_bundle);
+ var decryptResult = _fileSystem.LoadEncryptedBundleAsync(_bundle);
_createRequest = decryptResult.CreateRequest;
_managedStream = decryptResult.ManagedStream;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
index 22702aa4..de97c034 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
@@ -82,7 +82,7 @@ namespace YooAsset
{
try
{
- Catalog = CatalogTools.DeserializeFromBinary(_fileData);
+ Catalog = CatalogFileHelper.DeserializeFromBinary(_fileData);
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
index 2e28c6e5..7d31ccf5 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
@@ -86,7 +86,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- if (ManifestTools.VerifyManifestData(_fileData, _packageHash))
+ if (PackageManifestTools.VerifyManifestData(_fileData, _packageHash))
{
_steps = ESteps.LoadManifest;
}
@@ -102,7 +102,7 @@ namespace YooAsset
{
if (_deserializer == null)
{
- _deserializer = new DeserializeManifestOperation(_fileSystem.ManifestServices, _fileData);
+ _deserializer = new DeserializeManifestOperation(_fileSystem.ManifestRestoreServices, _fileData);
_deserializer.StartOperation();
AddChildOperation(_deserializer);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
index 7942406a..ad567b96 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
@@ -129,12 +129,12 @@ namespace YooAsset
///
/// 自定义参数:解密服务接口的实例类
///
- public IDecryptionServices DecryptionServices { private set; get; }
+ public IBundleDecryptionServices BundleDecryptionServices { private set; get; }
///
/// 自定义参数:资源清单服务类
///
- public IManifestRestoreServices ManifestServices { private set; get; }
+ public IManifestRestoreServices ManifestRestoreServices { private set; get; }
///
/// 自定义参数:拷贝内置文件接口的实例类
@@ -161,7 +161,7 @@ namespace YooAsset
var operation = new DCFSLoadPackageManifestOperation(this, options.PackageVersion, options.Timeout);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options)
{
if (options.ClearMode == EFileClearMode.ClearAllBundleFiles.ToString())
{
@@ -170,17 +170,17 @@ namespace YooAsset
}
else if (options.ClearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
{
- var operation = new ClearUnusedCacheBundleFilesOperation(this, manifest);
+ var operation = new ClearUnusedCacheBundleFilesOperation(this, options.Manifest);
return operation;
}
else if (options.ClearMode == EFileClearMode.ClearBundleFilesByLocations.ToString())
{
- var operation = new ClearCacheBundleFilesByLocationsOperaiton(this, manifest, options.ClearParam);
+ var operation = new ClearCacheBundleFilesByLocationsOperaiton(this, options.Manifest, options.ClearParam);
return operation;
}
else if (options.ClearMode == EFileClearMode.ClearBundleFilesByTags.ToString())
{
- var operation = new ClearCacheBundleFilesByTagsOperaiton(this, manifest, options.ClearParam);
+ var operation = new ClearCacheBundleFilesByTagsOperaiton(this, options.Manifest, options.ClearParam);
return operation;
}
else if (options.ClearMode == EFileClearMode.ClearAllManifestFiles.ToString())
@@ -190,7 +190,7 @@ namespace YooAsset
}
else if (options.ClearMode == EFileClearMode.ClearUnusedManifestFiles.ToString())
{
- var operation = new ClearUnusedCacheManifestFilesOperation(this, manifest);
+ var operation = new ClearUnusedCacheManifestFilesOperation(this, options.Manifest);
return operation;
}
else
@@ -200,9 +200,10 @@ namespace YooAsset
return operation;
}
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
+ public virtual FSDownloadFileOperation DownloadFileAsync(DownloadFileOptions options)
{
// 获取下载地址
+ PackageBundle bundle = options.Bundle;
if (string.IsNullOrEmpty(options.ImportFilePath))
{
// 注意:如果是解压文件系统类,这里会返回本地内置文件的下载路径
@@ -217,17 +218,18 @@ namespace YooAsset
options.SetURL(mainURL, mainURL);
}
- var downloader = new DownloadPackageBundleOperation(this, bundle, options);
+ var downloader = new DownloadPackageBundleOperation(this, options);
return downloader;
}
- public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
+ public virtual FSLoadBundleOperation LoadBundleAsync(LoadBundleOptions options)
{
- if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
+ PackageBundle bundle = options.Bundle;
+ if (bundle.BundleType == (int)EBundleType.AssetBundle)
{
var operation = new DCFSLoadAssetBundleOperation(this, bundle);
return operation;
}
- else if (bundle.BundleType == (int)EBuildBundleType.RawBundle)
+ else if (bundle.BundleType == (int)EBundleType.RawBundle)
{
var operation = new DCFSLoadRawBundleOperation(this, bundle);
return operation;
@@ -315,13 +317,13 @@ namespace YooAsset
{
ResumeDownloadResponseCodes = (List)value;
}
- else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
+ else if (name == FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES)
{
- DecryptionServices = (IDecryptionServices)value;
+ BundleDecryptionServices = (IBundleDecryptionServices)value;
}
- else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
+ else if (name == FileSystemParametersDefine.MANIFEST_RESTORE_SERVICES)
{
- ManifestServices = (IManifestRestoreServices)value;
+ ManifestRestoreServices = (IManifestRestoreServices)value;
}
else if (name == FileSystemParametersDefine.COPY_LOCAL_FILE_SERVICES)
{
@@ -403,20 +405,20 @@ namespace YooAsset
if (bundle.Encrypted)
{
- if (DecryptionServices == null)
+ if (BundleDecryptionServices == null)
{
- YooLogger.Error($"The {nameof(IDecryptionServices)} is null !");
+ YooLogger.Error($"The {nameof(IBundleDecryptionServices)} is null !");
return null;
}
string filePath = GetCacheBundleFileLoadPath(bundle);
- var fileInfo = new DecryptFileInfo()
+ var bundleInfo = new DecryptBundleInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
- return DecryptionServices.ReadFileData(fileInfo);
+ return BundleDecryptionServices.ReadFileData(bundleInfo);
}
else
{
@@ -431,20 +433,20 @@ namespace YooAsset
if (bundle.Encrypted)
{
- if (DecryptionServices == null)
+ if (BundleDecryptionServices == null)
{
- YooLogger.Error($"The {nameof(IDecryptionServices)} is null !");
+ YooLogger.Error($"The {nameof(IBundleDecryptionServices)} is null !");
return null;
}
string filePath = GetCacheBundleFileLoadPath(bundle);
- var fileInfo = new DecryptFileInfo()
+ var bundleInfo = new DecryptBundleInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
- return DecryptionServices.ReadFileText(fileInfo);
+ return BundleDecryptionServices.ReadFileText(bundleInfo);
}
else
{
@@ -649,46 +651,46 @@ namespace YooAsset
///
/// 加载加密资源文件
///
- public DecryptResult LoadEncryptedAssetBundle(PackageBundle bundle)
+ public DecryptSyncResult LoadEncryptedBundleSync(PackageBundle bundle)
{
string filePath = GetCacheBundleFileLoadPath(bundle);
- var fileInfo = new DecryptFileInfo()
+ var bundleInfo = new DecryptBundleInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
- return DecryptionServices.LoadAssetBundle(fileInfo);
+ return BundleDecryptionServices.LoadAssetBundleSync(bundleInfo);
}
///
/// 加载加密资源文件
///
- public DecryptResult LoadEncryptedAssetBundleAsync(PackageBundle bundle)
+ public DecryptAsyncResult LoadEncryptedBundleAsync(PackageBundle bundle)
{
string filePath = GetCacheBundleFileLoadPath(bundle);
- var fileInfo = new DecryptFileInfo()
+ var bundleInfo = new DecryptBundleInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
- return DecryptionServices.LoadAssetBundleAsync(fileInfo);
+ return BundleDecryptionServices.LoadAssetBundleAsync(bundleInfo);
}
///
/// 加载加密资源文件
///
- public DecryptResult LoadEncryptedAssetBundleFallback(PackageBundle bundle)
+ public DecryptSyncResult LoadEncryptedBundleFallback(PackageBundle bundle)
{
string filePath = GetCacheBundleFileLoadPath(bundle);
- var fileInfo = new DecryptFileInfo()
+ var bundleInfo = new DecryptBundleInfo()
{
BundleName = bundle.BundleName,
FileLoadCRC = bundle.UnityCRC,
FileLoadPath = filePath,
};
- return DecryptionServices.LoadAssetBundleFallback(fileInfo);
+ return BundleDecryptionServices.LoadAssetBundleFallback(bundleInfo);
}
#endregion
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
index 2c4331a9..a72a1c28 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
@@ -79,8 +79,8 @@ namespace YooAsset
{
if (_downloadFileOp == null)
{
- DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
- _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
+ DownloadFileOptions options = new DownloadFileOptions(_bundle, int.MaxValue);
+ _downloadFileOp = _fileSystem.DownloadFileAsync(options);
_downloadFileOp.StartOperation();
AddChildOperation(_downloadFileOp);
}
@@ -127,11 +127,11 @@ namespace YooAsset
{
if (_bundle.Encrypted)
{
- if (_fileSystem.DecryptionServices == null)
+ if (_fileSystem.BundleDecryptionServices == null)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = $"The {nameof(IDecryptionServices)} is null !";
+ Error = $"The {nameof(IBundleDecryptionServices)} is null !";
YooLogger.Error(Error);
return;
}
@@ -141,7 +141,7 @@ namespace YooAsset
{
if (_bundle.Encrypted)
{
- var decryptResult = _fileSystem.LoadEncryptedAssetBundle(_bundle);
+ var decryptResult = _fileSystem.LoadEncryptedBundleSync(_bundle);
_assetBundle = decryptResult.Result;
_managedStream = decryptResult.ManagedStream;
}
@@ -155,7 +155,7 @@ namespace YooAsset
{
if (_bundle.Encrypted)
{
- var decryptResult = _fileSystem.LoadEncryptedAssetBundleAsync(_bundle);
+ var decryptResult = _fileSystem.LoadEncryptedBundleAsync(_bundle);
_createRequest = decryptResult.CreateRequest;
_managedStream = decryptResult.ManagedStream;
}
@@ -202,7 +202,7 @@ namespace YooAsset
{
if (_bundle.Encrypted)
{
- var decryptResult = _fileSystem.LoadEncryptedAssetBundleFallback(_bundle);
+ var decryptResult = _fileSystem.LoadEncryptedBundleFallback(_bundle);
_assetBundle = decryptResult.Result;
if (_assetBundle != null)
{
@@ -348,8 +348,8 @@ namespace YooAsset
{
if (_downloadFileOp == null)
{
- DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
- _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
+ DownloadFileOptions options = new DownloadFileOptions(_bundle, int.MaxValue);
+ _downloadFileOp = _fileSystem.DownloadFileAsync(options);
_downloadFileOp.StartOperation();
AddChildOperation(_downloadFileOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageBundleOperation.cs
index e9126d30..b37de876 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadPackageBundleOperation.cs
@@ -26,7 +26,7 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
- internal DownloadPackageBundleOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle)
+ internal DownloadPackageBundleOperation(DefaultCacheFileSystem fileSystem, DownloadFileOptions options) : base(options.Bundle)
{
_fileSystem = fileSystem;
_options = options;
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
index 4f349184..5d652e1b 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
@@ -59,7 +59,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- if (ManifestTools.VerifyManifestData(_fileData, _packageHash))
+ if (PackageManifestTools.VerifyManifestData(_fileData, _packageHash))
{
_steps = ESteps.LoadManifest;
}
@@ -75,7 +75,7 @@ namespace YooAsset
{
if (_deserializer == null)
{
- _deserializer = new DeserializeManifestOperation(_fileSystem.ManifestServices, _fileData);
+ _deserializer = new DeserializeManifestOperation(_fileSystem.ManifestRestoreServices, _fileData);
_deserializer.StartOperation();
AddChildOperation(_deserializer);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
index 36e86631..6de70f8c 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
@@ -93,21 +93,22 @@ namespace YooAsset
var operation = new DEFSLoadPackageManifestOperation(this, options.PackageVersion);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options)
{
var operation = new FSClearCacheFilesCompleteOperation();
return operation;
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
+ public virtual FSDownloadFileOperation DownloadFileAsync(DownloadFileOptions options)
{
- string mainURL = bundle.BundleName;
+ string mainURL = options.Bundle.BundleName;
options.SetURL(mainURL, mainURL);
- var downloader = new DownloadVirtualBundleOperation(this, bundle, options);
+ var downloader = new DownloadVirtualBundleOperation(this, options);
return downloader;
}
- public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
+ public virtual FSLoadBundleOperation LoadBundleAsync(LoadBundleOptions options)
{
- if (bundle.BundleType == (int)EBuildBundleType.VirtualBundle)
+ PackageBundle bundle = options.Bundle;
+ if (bundle.BundleType == (int)EBundleType.VirtualBundle)
{
var operation = new DEFSLoadBundleOperation(this, bundle);
return operation;
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSLoadBundleOperation.cs
index bee45a28..79d49804 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/DEFSLoadBundleOperation.cs
@@ -64,8 +64,8 @@ namespace YooAsset
{
if (_downloadFileOp == null)
{
- DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
- _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
+ DownloadFileOptions options = new DownloadFileOptions(_bundle, int.MaxValue);
+ _downloadFileOp = _fileSystem.DownloadFileAsync(options);
_downloadFileOp.StartOperation();
AddChildOperation(_downloadFileOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/DownloadVirutalBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/DownloadVirutalBundleOperation.cs
index ec6ac221..5a875f56 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/DownloadVirutalBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/DownloadVirutalBundleOperation.cs
@@ -25,7 +25,7 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
- internal DownloadVirtualBundleOperation(DefaultEditorFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle)
+ internal DownloadVirtualBundleOperation(DefaultEditorFileSystem fileSystem, DownloadFileOptions options) : base(options.Bundle)
{
_fileSystem = fileSystem;
_options = options;
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
index c6ebcc4b..3d1647c0 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
@@ -59,7 +59,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- if (ManifestTools.VerifyManifestData(_fileData, _packageHash))
+ if (PackageManifestTools.VerifyManifestData(_fileData, _packageHash))
{
_steps = ESteps.LoadManifest;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/DefaultWebRemoteFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/DefaultWebRemoteFileSystem.cs
index 402b93bb..e7a2dae4 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/DefaultWebRemoteFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/DefaultWebRemoteFileSystem.cs
@@ -61,12 +61,12 @@ namespace YooAsset
///
/// 自定义参数:解密服务接口的实例类
///
- public IWebDecryptionServices DecryptionServices { private set; get; }
+ public IWebBundleDecryptionServices BundleDecryptionServices { private set; get; }
///
/// 自定义参数:资源清单服务类
///
- public IManifestRestoreServices ManifestServices { private set; get; }
+ public IManifestRestoreServices ManifestRestoreServices { private set; get; }
#endregion
@@ -88,18 +88,19 @@ namespace YooAsset
var operation = new DWRFSLoadPackageManifestOperation(this, options.PackageVersion, options.Timeout);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options)
{
var operation = new FSClearCacheFilesCompleteOperation();
return operation;
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
+ public virtual FSDownloadFileOperation DownloadFileAsync(DownloadFileOptions options)
{
throw new System.NotImplementedException();
}
- public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
+ public virtual FSLoadBundleOperation LoadBundleAsync(LoadBundleOptions options)
{
- if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
+ PackageBundle bundle = options.Bundle;
+ if (bundle.BundleType == (int)EBundleType.AssetBundle)
{
var operation = new DWRFSLoadAssetBundleOperation(this, bundle);
return operation;
@@ -130,13 +131,13 @@ namespace YooAsset
{
RemoteServices = (IRemoteServices)value;
}
- else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
+ else if (name == FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES)
{
- DecryptionServices = (IWebDecryptionServices)value;
+ BundleDecryptionServices = (IWebBundleDecryptionServices)value;
}
- else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
+ else if (name == FileSystemParametersDefine.MANIFEST_RESTORE_SERVICES)
{
- ManifestServices = (IManifestRestoreServices)value;
+ ManifestRestoreServices = (IManifestRestoreServices)value;
}
else
{
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadBundleOperation.cs
index a09f0438..e4af1e67 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadBundleOperation.cs
@@ -36,18 +36,18 @@ namespace YooAsset
{
string mainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName);
string fallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
- DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
+ DownloadFileOptions options = new DownloadFileOptions(_bundle, int.MaxValue);
options.SetURL(mainURL, fallbackURL);
if (_bundle.Encrypted)
{
- _loadWebAssetBundleOp = new LoadWebEncryptAssetBundleOperation(_bundle, options, _fileSystem.DecryptionServices, _fileSystem.DownloadBackend);
+ _loadWebAssetBundleOp = new LoadWebEncryptAssetBundleOperation(options, _fileSystem.BundleDecryptionServices, _fileSystem.DownloadBackend);
_loadWebAssetBundleOp.StartOperation();
AddChildOperation(_loadWebAssetBundleOp);
}
else
{
- _loadWebAssetBundleOp = new LoadWebNormalAssetBundleOperation(_bundle, options, _fileSystem.DisableUnityWebCache, _fileSystem.DownloadBackend);
+ _loadWebAssetBundleOp = new LoadWebNormalAssetBundleOperation(options, _fileSystem.DisableUnityWebCache, _fileSystem.DownloadBackend);
_loadWebAssetBundleOp.StartOperation();
AddChildOperation(_loadWebAssetBundleOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadPackageManifestOperation.cs
index c0c68ba4..cddf2650 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadPackageManifestOperation.cs
@@ -65,7 +65,7 @@ namespace YooAsset
{
string packageHash = _requestWebPackageHashOp.PackageHash;
string packageName = _fileSystem.PackageName;
- var manifestServices = _fileSystem.ManifestServices;
+ var manifestServices = _fileSystem.ManifestRestoreServices;
var remoteServices = _fileSystem.RemoteServices;
var downloadBackend = _fileSystem.DownloadBackend;
_loadWebPackageManifestOp = new LoadWebPackageManifestOperation(manifestServices, remoteServices, downloadBackend, packageName, _packageVersion, packageHash, _timeout);
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/DefaultWebServerFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/DefaultWebServerFileSystem.cs
index 62985b19..a7e7e684 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/DefaultWebServerFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/DefaultWebServerFileSystem.cs
@@ -70,12 +70,12 @@ namespace YooAsset
///
/// 自定义参数:解密服务接口的实例类
///
- public IWebDecryptionServices DecryptionServices { private set; get; }
+ public IWebBundleDecryptionServices BundleDecryptionServices { private set; get; }
///
/// 自定义参数:资源清单服务类
///
- public IManifestRestoreServices ManifestServices { private set; get; }
+ public IManifestRestoreServices ManifestRestoreServices { private set; get; }
#endregion
@@ -97,18 +97,19 @@ namespace YooAsset
var operation = new DWSFSLoadPackageManifestOperation(this, options.PackageVersion, options.Timeout);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options)
{
var operation = new FSClearCacheFilesCompleteOperation();
return operation;
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
+ public virtual FSDownloadFileOperation DownloadFileAsync(DownloadFileOptions options)
{
throw new System.NotImplementedException();
}
- public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
+ public virtual FSLoadBundleOperation LoadBundleAsync(LoadBundleOptions options)
{
- if (bundle.BundleType == (int)EBuildBundleType.AssetBundle)
+ PackageBundle bundle = options.Bundle;
+ if (bundle.BundleType == (int)EBundleType.AssetBundle)
{
var operation = new DWSFSLoadAssetBundleOperation(this, bundle);
return operation;
@@ -135,13 +136,13 @@ namespace YooAsset
{
DisableUnityWebCache = Convert.ToBoolean(value);
}
- else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
+ else if (name == FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES)
{
- DecryptionServices = (IWebDecryptionServices)value;
+ BundleDecryptionServices = (IWebBundleDecryptionServices)value;
}
- else if (name == FileSystemParametersDefine.MANIFEST_SERVICES)
+ else if (name == FileSystemParametersDefine.MANIFEST_RESTORE_SERVICES)
{
- ManifestServices = (IManifestRestoreServices)value;
+ ManifestRestoreServices = (IManifestRestoreServices)value;
}
else
{
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadBundleOperation.cs
index 0a4c21b6..025ee5e8 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadBundleOperation.cs
@@ -36,18 +36,18 @@ namespace YooAsset
{
string fileLoadPath = _fileSystem.GetWebFileLoadPath(_bundle);
string mainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
- DownloadFileOptions options = new DownloadFileOptions(int.MaxValue);
+ DownloadFileOptions options = new DownloadFileOptions(_bundle, int.MaxValue);
options.SetURL(mainURL, mainURL);
if (_bundle.Encrypted)
{
- _loadWebAssetBundleOp = new LoadWebEncryptAssetBundleOperation(_bundle, options, _fileSystem.DecryptionServices, _fileSystem.DownloadBackend);
+ _loadWebAssetBundleOp = new LoadWebEncryptAssetBundleOperation(options, _fileSystem.BundleDecryptionServices, _fileSystem.DownloadBackend);
_loadWebAssetBundleOp.StartOperation();
AddChildOperation(_loadWebAssetBundleOp);
}
else
{
- _loadWebAssetBundleOp = new LoadWebNormalAssetBundleOperation(_bundle, options, _fileSystem.DisableUnityWebCache, _fileSystem.DownloadBackend);
+ _loadWebAssetBundleOp = new LoadWebNormalAssetBundleOperation(options, _fileSystem.DisableUnityWebCache, _fileSystem.DownloadBackend);
_loadWebAssetBundleOp.StartOperation();
AddChildOperation(_loadWebAssetBundleOp);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
index 786c5a49..3fede7be 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
@@ -61,7 +61,7 @@ namespace YooAsset
{
try
{
- var catalog = CatalogTools.DeserializeFromBinary(_webDataRequestOp.Result);
+ var catalog = CatalogFileHelper.DeserializeFromBinary(_webDataRequestOp.Result);
if (catalog.PackageName != _fileSystem.PackageName)
{
_steps = ESteps.Done;
diff --git a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
index a0165137..68f3b57a 100644
--- a/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
@@ -70,7 +70,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- if (ManifestTools.VerifyManifestData(_webDataRequestOp.Result, _packageHash))
+ if (PackageManifestTools.VerifyManifestData(_webDataRequestOp.Result, _packageHash))
{
_steps = ESteps.LoadManifest;
}
@@ -86,7 +86,7 @@ namespace YooAsset
{
if (_deserializer == null)
{
- _deserializer = new DeserializeManifestOperation(_fileSystem.ManifestServices, _webDataRequestOp.Result);
+ _deserializer = new DeserializeManifestOperation(_fileSystem.ManifestRestoreServices, _webDataRequestOp.Result);
_deserializer.StartOperation();
AddChildOperation(_deserializer);
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/FileSystemParameters.cs b/Assets/YooAsset/Runtime/FileSystem/FileSystemParameters.cs
index 6a927ae5..f10c5e32 100644
--- a/Assets/YooAsset/Runtime/FileSystem/FileSystemParameters.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/FileSystemParameters.cs
@@ -83,11 +83,11 @@ namespace YooAsset
///
/// 加密文件解密服务类
/// 文件系统的根目录
- public static FileSystemParameters CreateDefaultBuildinFileSystemParameters(IDecryptionServices decryptionServices = null, string packageRoot = null)
+ public static FileSystemParameters CreateDefaultBuildinFileSystemParameters(IBundleDecryptionServices decryptionServices = null, string packageRoot = null)
{
string fileSystemClass = typeof(DefaultBuildinFileSystem).FullName;
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
- fileSystemParams.AddParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, decryptionServices);
+ fileSystemParams.AddParameter(FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES, decryptionServices);
return fileSystemParams;
}
@@ -97,12 +97,12 @@ namespace YooAsset
/// 远端资源地址查询服务类
/// 加密文件解密服务类
/// 文件系统的根目录
- public static FileSystemParameters CreateDefaultCacheFileSystemParameters(IRemoteServices remoteServices, IDecryptionServices decryptionServices = null, string packageRoot = null)
+ public static FileSystemParameters CreateDefaultCacheFileSystemParameters(IRemoteServices remoteServices, IBundleDecryptionServices decryptionServices = null, string packageRoot = null)
{
string fileSystemClass = typeof(DefaultCacheFileSystem).FullName;
var fileSystemParams = new FileSystemParameters(fileSystemClass, packageRoot);
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
- fileSystemParams.AddParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, decryptionServices);
+ fileSystemParams.AddParameter(FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES, decryptionServices);
return fileSystemParams;
}
@@ -111,11 +111,11 @@ namespace YooAsset
///
/// 加密文件解密服务类
/// 禁用Unity的网络缓存
- public static FileSystemParameters CreateDefaultWebServerFileSystemParameters(IWebDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
+ public static FileSystemParameters CreateDefaultWebServerFileSystemParameters(IWebBundleDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
{
string fileSystemClass = typeof(DefaultWebServerFileSystem).FullName;
var fileSystemParams = new FileSystemParameters(fileSystemClass, null);
- fileSystemParams.AddParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, decryptionServices);
+ fileSystemParams.AddParameter(FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES, decryptionServices);
fileSystemParams.AddParameter(FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE, disableUnityWebCache);
return fileSystemParams;
}
@@ -126,12 +126,12 @@ namespace YooAsset
/// 远端资源地址查询服务类
/// 加密文件解密服务类
/// 禁用Unity的网络缓存
- public static FileSystemParameters CreateDefaultWebRemoteFileSystemParameters(IRemoteServices remoteServices, IWebDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
+ public static FileSystemParameters CreateDefaultWebRemoteFileSystemParameters(IRemoteServices remoteServices, IWebBundleDecryptionServices decryptionServices = null, bool disableUnityWebCache = false)
{
string fileSystemClass = typeof(DefaultWebRemoteFileSystem).FullName;
var fileSystemParams = new FileSystemParameters(fileSystemClass, null);
fileSystemParams.AddParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
- fileSystemParams.AddParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, decryptionServices);
+ fileSystemParams.AddParameter(FileSystemParametersDefine.BUNDLE_DECRYPTION_SERVICES, decryptionServices);
fileSystemParams.AddParameter(FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE, disableUnityWebCache);
return fileSystemParams;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs b/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs
index b177c743..924b5eb2 100644
--- a/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs
@@ -7,102 +7,127 @@ namespace YooAsset
/// 初始化的时候缓存文件校验级别
///
public const string FILE_VERIFY_LEVEL = "FILE_VERIFY_LEVEL";
+
///
/// 初始化的时候缓存文件校验最大并发数
///
public const string FILE_VERIFY_MAX_CONCURRENCY = "FILE_VERIFY_MAX_CONCURRENCY";
+
///
/// 覆盖安装缓存清理模式
///
public const string INSTALL_CLEAR_MODE = "INSTALL_CLEAR_MODE";
+
///
/// 远端资源地址查询服务类
///
public const string REMOTE_SERVICES = "REMOTE_SERVICES";
+
///
- /// 解密服务接口的实例类
+ /// 解密服务接口的实例类
///
- public const string DECRYPTION_SERVICES = "DECRYPTION_SERVICES";
+ public const string BUNDLE_DECRYPTION_SERVICES = "BUNDLE_DECRYPTION_SERVICES";
+
///
/// 资源清单服务类
///
- public const string MANIFEST_SERVICES = "MANIFEST_SERVICES";
+ public const string MANIFEST_RESTORE_SERVICES = "MANIFEST_RESTORE_SERVICES";
+
///
/// 数据文件追加文件格式
///
public const string APPEND_FILE_EXTENSION = "APPEND_FILE_EXTENSION";
+
///
/// 禁用Catalog目录查询文件
///
public const string DISABLE_CATALOG_FILE = "DISABLE_CATALOG_FILE";
+
///
/// 禁用Unity的网络缓存
///
public const string DISABLE_UNITY_WEB_CACHE = "DISABLE_UNITY_WEB_CACHE";
+
///
/// 禁用边玩边下机制
///
public const string DISABLE_ONDEMAND_DOWNLOAD = "DISABLE_ONDEMAND_DOWNLOAD";
+
///
/// UnityWebRequest 创建委托
///
public const string UNITY_WEB_REQUEST_CREATOR = "UNITY_WEB_REQUEST_CREATOR";
+
///
/// 下载后台接口
///
public const string DOWNLOAD_BACKEND = "DOWNLOAD_BACKEND";
+
///
/// 最大并发连接数 默认值:10(推荐范围 1-32)
///
public const string DOWNLOAD_MAX_CONCURRENCY = "DOWNLOAD_MAX_CONCURRENCY";
+
///
/// 每帧发起的最大请求数 默认值:5(推荐范围 1-10)
///
public const string DOWNLOAD_MAX_REQUEST_PER_FRAME = "DOWNLOAD_MAX_REQUEST_PER_FRAME";
+
///
/// 下载任务的看门狗机制监控时间
///
public const string DOWNLOAD_WATCH_DOG_TIME = "DOWNLOAD_WATCH_DOG_TIME";
+
///
/// 启用断点续传的最小尺寸
///
public const string RESUME_DOWNLOAD_MINMUM_SIZE = "RESUME_DOWNLOAD_MINMUM_SIZE";
+
///
/// 断点续传下载器关注的错误码 >
///
public const string RESUME_DOWNLOAD_RESPONSE_CODES = "RESUME_DOWNLOAD_RESPONSE_CODES";
+
///
/// 模拟WebGL平台模式
///
public const string VIRTUAL_WEBGL_MODE = "VIRTUAL_WEBGL_MODE";
+
///
/// 模拟虚拟下载模式
///
public const string VIRTUAL_DOWNLOAD_MODE = "VIRTUAL_DOWNLOAD_MODE";
+
///
/// 模拟虚拟下载的网速(单位:字节)
///
public const string VIRTUAL_DOWNLOAD_SPEED = "VIRTUAL_DOWNLOAD_SPEED";
+
///
/// 异步模拟加载最小帧数
///
public const string ASYNC_SIMULATE_MIN_FRAME = "ASYNC_SIMULATE_MIN_FRAME";
+
///
/// 异步模拟加载最大帧数
///
public const string ASYNC_SIMULATE_MAX_FRAME = "ASYNC_SIMULATE_MAX_FRAME";
+
///
/// 拷贝内置清单
///
public const string COPY_BUILDIN_PACKAGE_MANIFEST = "COPY_BUILDIN_PACKAGE_MANIFEST";
+
///
/// 拷贝内置清单的目标目录
///
public const string COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT = "COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT";
+
///
/// 拷贝内置文件接口的实例类
///
public const string COPY_LOCAL_FILE_SERVICES = "COPY_LOCAL_FILE_SERVICES";
+
///
/// 解压文件系统的根目录
///
diff --git a/Assets/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs b/Assets/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
index 4f491341..44c43fbf 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
@@ -37,17 +37,17 @@ namespace YooAsset
///
/// 清理缓存文件
///
- FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options);
+ FSClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options);
///
/// 下载Bundle文件
///
- FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options);
+ FSDownloadFileOperation DownloadFileAsync(DownloadFileOptions options);
///
/// 加载Bundle文件
///
- FSLoadBundleOperation LoadBundleFile(PackageBundle bundle);
+ FSLoadBundleOperation LoadBundleAsync(LoadBundleOptions options);
///
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
index 102fc9e5..f4f9693a 100644
--- a/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
@@ -1,54 +1,6 @@
namespace YooAsset
{
- internal class DownloadFileOptions
- {
- ///
- /// 失败后重试次数
- ///
- public readonly int FailedTryAgain;
-
- ///
- /// 主资源地址
- ///
- public string MainURL { private set; get; }
-
- ///
- /// 备用资源地址
- ///
- public string FallbackURL { private set; get; }
-
- ///
- /// 拷贝的本地文件路径
- ///
- public string ImportFilePath { set; get; }
-
- public DownloadFileOptions(int failedTryAgain)
- {
- FailedTryAgain = failedTryAgain;
- }
-
- ///
- /// 设置下载地址
- ///
- public void SetURL(string mainURL, string fallbackURL)
- {
- MainURL = mainURL;
- FallbackURL = fallbackURL;
- }
-
- ///
- /// 是否有效
- ///
- public bool IsValid()
- {
- if (string.IsNullOrEmpty(MainURL) || string.IsNullOrEmpty(FallbackURL))
- return false;
-
- return true;
- }
- }
-
internal abstract class FSDownloadFileOperation : AsyncOperationBase
{
public PackageBundle Bundle { private set; get; }
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOptions.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOptions.cs
new file mode 100644
index 00000000..af3e5658
--- /dev/null
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOptions.cs
@@ -0,0 +1,60 @@
+
+namespace YooAsset
+{
+ internal struct DownloadFileOptions
+ {
+ ///
+ /// 资源包
+ ///
+ public readonly PackageBundle Bundle;
+
+ ///
+ /// 失败后重试次数
+ ///
+ public readonly int FailedTryAgain;
+
+ ///
+ /// 主资源地址
+ ///
+ public string MainURL { private set; get; }
+
+ ///
+ /// 备用资源地址
+ ///
+ public string FallbackURL { private set; get; }
+
+ ///
+ /// 拷贝的本地文件路径
+ ///
+ public string ImportFilePath { set; get; }
+
+ public DownloadFileOptions(PackageBundle bundle, int failedTryAgain)
+ {
+ Bundle = bundle;
+ FailedTryAgain = failedTryAgain;
+ MainURL = null;
+ FallbackURL = null;
+ ImportFilePath = null;
+ }
+
+ ///
+ /// 设置下载地址
+ ///
+ public void SetURL(string mainURL, string fallbackURL)
+ {
+ MainURL = mainURL;
+ FallbackURL = fallbackURL;
+ }
+
+ ///
+ /// 是否有效
+ ///
+ public bool IsValid()
+ {
+ if (string.IsNullOrEmpty(MainURL) || string.IsNullOrEmpty(FallbackURL))
+ return false;
+
+ return true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/Services/IWebDecryptionServices.cs.meta b/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOptions.cs.meta
similarity index 83%
rename from Assets/YooAsset/Runtime/Services/IWebDecryptionServices.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOptions.cs.meta
index 5616d69f..a9da4eeb 100644
--- a/Assets/YooAsset/Runtime/Services/IWebDecryptionServices.cs.meta
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOptions.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 9143514bc9d4f3e4aa9a50a7cfb08d21
+guid: ae6a979ad693ddf488c7a0f387c6ea76
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOptions.cs b/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOptions.cs
new file mode 100644
index 00000000..ec3dcf0c
--- /dev/null
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOptions.cs
@@ -0,0 +1,16 @@
+
+namespace YooAsset
+{
+ internal struct LoadBundleOptions
+ {
+ ///
+ /// 资源包
+ ///
+ public readonly PackageBundle Bundle;
+
+ public LoadBundleOptions(PackageBundle bundle)
+ {
+ Bundle = bundle;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IBundleQuery.cs.meta b/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOptions.cs.meta
similarity index 83%
rename from Assets/YooAsset/Runtime/ResourcePackage/Interface/IBundleQuery.cs.meta
rename to Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOptions.cs.meta
index c0796aa2..0b238221 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IBundleQuery.cs.meta
+++ b/Assets/YooAsset/Runtime/FileSystem/Operation/FSLoadBundleOptions.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 70420213c551a2b4b8cf014067699b07
+guid: 3d4cf0ce3cf4c794fa2d40665d5f3147
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebEncryptAssetBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebEncryptAssetBundleOperation.cs
index 36cf9ef7..a13fde66 100644
--- a/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebEncryptAssetBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebEncryptAssetBundleOperation.cs
@@ -13,9 +13,8 @@ namespace YooAsset
Done,
}
- private readonly PackageBundle _bundle;
private readonly DownloadFileOptions _options;
- private readonly IWebDecryptionServices _decryptionServices;
+ private readonly IWebBundleDecryptionServices _decryptionServices;
private readonly IDownloadBackend _downloadBackend;
private IDownloadBytesRequest _unityWebDataRequestOp;
@@ -24,9 +23,8 @@ namespace YooAsset
private int _failedTryAgain;
private ESteps _steps = ESteps.None;
- internal LoadWebEncryptAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, IWebDecryptionServices decryptionServices, IDownloadBackend downloadBackend)
+ internal LoadWebEncryptAssetBundleOperation(DownloadFileOptions options, IWebBundleDecryptionServices decryptionServices, IDownloadBackend downloadBackend)
{
- _bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
_decryptionServices = decryptionServices;
@@ -48,7 +46,7 @@ namespace YooAsset
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = $"The {nameof(IWebDecryptionServices)} is null !";
+ Error = $"The {nameof(IWebBundleDecryptionServices)} is null !";
YooLogger.Error(Error);
return;
}
@@ -124,11 +122,11 @@ namespace YooAsset
///
private AssetBundle LoadEncryptedAssetBundle(byte[] fileData)
{
- var fileInfo = new WebDecryptFileInfo();
- fileInfo.BundleName = _bundle.BundleName;
- fileInfo.FileLoadCRC = _bundle.UnityCRC;
+ var fileInfo = new WebDecryptBundleInfo();
+ fileInfo.BundleName = _options.Bundle.BundleName;
+ fileInfo.FileLoadCRC = _options.Bundle.UnityCRC;
fileInfo.FileData = fileData;
- var decryptResult = _decryptionServices.LoadAssetBundle(fileInfo);
+ var decryptResult = _decryptionServices.LoadAssetBundleSync(fileInfo);
return decryptResult.Result;
}
diff --git a/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebNormalAssetBundleOperation.cs b/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebNormalAssetBundleOperation.cs
index e392c349..198ef9ca 100644
--- a/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebNormalAssetBundleOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebNormalAssetBundleOperation.cs
@@ -13,7 +13,6 @@ namespace YooAsset
Done,
}
- private readonly PackageBundle _bundle;
private readonly DownloadFileOptions _options;
private readonly bool _disableUnityWebCache;
private readonly IDownloadBackend _downloadBackend;
@@ -25,9 +24,8 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
- internal LoadWebNormalAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options, bool disableUnityWebCache, IDownloadBackend downloadBackend)
+ internal LoadWebNormalAssetBundleOperation(DownloadFileOptions options, bool disableUnityWebCache, IDownloadBackend downloadBackend)
{
- _bundle = bundle;
_options = options;
_failedTryAgain = options.FailedTryAgain;
_disableUnityWebCache = disableUnityWebCache;
@@ -46,7 +44,7 @@ namespace YooAsset
if (_steps == ESteps.CreateRequest)
{
string url = GetRequestURL();
- var args = new DownloadAssetBundleRequestArgs(url, 0, 0, _disableUnityWebCache, _bundle.FileHash, _bundle.UnityCRC);
+ var args = new DownloadAssetBundleRequestArgs(url, 0, 0, _disableUnityWebCache, _options.Bundle.FileHash, _options.Bundle.UnityCRC);
_unityAssetBundleRequestOp = _downloadBackend.CreateAssetBundleRequest(args);
_unityAssetBundleRequestOp.SendRequest();
_steps = ESteps.CheckRequest;
diff --git a/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebPackageManifestOperation.cs b/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebPackageManifestOperation.cs
index 03014d54..72809342 100644
--- a/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/FileSystem/WebGame/Operation/LoadWebPackageManifestOperation.cs
@@ -80,7 +80,7 @@ internal class LoadWebPackageManifestOperation : AsyncOperationBase
if (_steps == ESteps.VerifyFileData)
{
- if (ManifestTools.VerifyManifestData(_webDataRequestOp.Result, _packageHash))
+ if (PackageManifestTools.VerifyManifestData(_webDataRequestOp.Result, _packageHash))
{
_steps = ESteps.LoadManifest;
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeHelper.cs b/Assets/YooAsset/Runtime/PackageInvokeBuilder/EditorSimulateBuildInvoker.cs
similarity index 79%
rename from Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeHelper.cs
rename to Assets/YooAsset/Runtime/PackageInvokeBuilder/EditorSimulateBuildInvoker.cs
index 96e93389..d396ab48 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeHelper.cs
+++ b/Assets/YooAsset/Runtime/PackageInvokeBuilder/EditorSimulateBuildInvoker.cs
@@ -1,9 +1,9 @@
namespace YooAsset
{
- public class EditorSimulateModeHelper
+ public class EditorSimulateBuildInvoker
{
- public static PackageInvokeBuildResult SimulateBuild(string packageName)
+ public static PackageInvokeBuildResult Build(string packageName)
{
var buildParam = new PackageInvokeBuildParam(packageName);
buildParam.BuildPipelineName = "EditorSimulateBuildPipeline";
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeHelper.cs.meta b/Assets/YooAsset/Runtime/PackageInvokeBuilder/EditorSimulateBuildInvoker.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/ResourcePackage/PlayMode/EditorSimulateModeHelper.cs.meta
rename to Assets/YooAsset/Runtime/PackageInvokeBuilder/EditorSimulateBuildInvoker.cs.meta
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Handle/AssetHandle.cs b/Assets/YooAsset/Runtime/ResourceManager/Handle/AssetHandle.cs
index 5514d09a..c6f443a8 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/Handle/AssetHandle.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/Handle/AssetHandle.cs
@@ -76,62 +76,48 @@ namespace YooAsset
///
public GameObject InstantiateSync()
{
- return InstantiateSyncInternal(false, Vector3.zero, Quaternion.identity, null, false);
+ var options = new InstantiateOptions(true);
+ return InstantiateSyncInternal(options);
}
- public GameObject InstantiateSync(Transform parent)
+
+ ///
+ /// 同步初始化游戏对象
+ ///
+ public GameObject InstantiateSync(InstantiateOptions options)
{
- return InstantiateSyncInternal(false, Vector3.zero, Quaternion.identity, parent, false);
- }
- public GameObject InstantiateSync(Transform parent, bool worldPositionStays)
- {
- return InstantiateSyncInternal(false, Vector3.zero, Quaternion.identity, parent, worldPositionStays);
- }
- public GameObject InstantiateSync(Vector3 position, Quaternion rotation)
- {
- return InstantiateSyncInternal(true, position, rotation, null, false);
- }
- public GameObject InstantiateSync(Vector3 position, Quaternion rotation, Transform parent)
- {
- return InstantiateSyncInternal(true, position, rotation, parent, false);
+ return InstantiateSyncInternal(options);
}
///
/// 异步初始化游戏对象
///
- public InstantiateOperation InstantiateAsync(bool actived = true)
+ public InstantiateOperation InstantiateAsync()
{
- return InstantiateAsyncInternal(false, Vector3.zero, Quaternion.identity, null, false, actived);
- }
- public InstantiateOperation InstantiateAsync(Transform parent, bool actived = true)
- {
- return InstantiateAsyncInternal(false, Vector3.zero, Quaternion.identity, parent, false, actived);
- }
- public InstantiateOperation InstantiateAsync(Transform parent, bool worldPositionStays, bool actived = true)
- {
- return InstantiateAsyncInternal(false, Vector3.zero, Quaternion.identity, parent, worldPositionStays, actived);
- }
- public InstantiateOperation InstantiateAsync(Vector3 position, Quaternion rotation, bool actived = true)
- {
- return InstantiateAsyncInternal(true, position, rotation, null, false, actived);
- }
- public InstantiateOperation InstantiateAsync(Vector3 position, Quaternion rotation, Transform parent, bool actived = true)
- {
- return InstantiateAsyncInternal(true, position, rotation, parent, false, actived);
+ var options = new InstantiateOptions(true);
+ return InstantiateAsyncInternal(options);
}
- private GameObject InstantiateSyncInternal(bool setPositionAndRotation, Vector3 position, Quaternion rotation, Transform parent, bool worldPositionStays)
+ ///
+ /// 异步初始化游戏对象
+ ///
+ public InstantiateOperation InstantiateAsync(InstantiateOptions options)
+ {
+ return InstantiateAsyncInternal(options);
+ }
+
+ private GameObject InstantiateSyncInternal(InstantiateOptions options)
{
if (IsValidWithWarning == false)
return null;
if (Provider.AssetObject == null)
return null;
- return InstantiateOperation.InstantiateInternal(Provider.AssetObject, setPositionAndRotation, position, rotation, parent, worldPositionStays);
+ return InstantiateOperation.InstantiateInternal(Provider.AssetObject, options);
}
- private InstantiateOperation InstantiateAsyncInternal(bool setPositionAndRotation, Vector3 position, Quaternion rotation, Transform parent, bool worldPositionStays, bool actived)
+ private InstantiateOperation InstantiateAsyncInternal(InstantiateOptions options)
{
string packageName = GetAssetInfo().PackageName;
- InstantiateOperation operation = new InstantiateOperation(this, setPositionAndRotation, position, rotation, parent, worldPositionStays, actived);
+ InstantiateOperation operation = new InstantiateOperation(this, options);
OperationSystem.StartOperation(packageName, operation);
return operation;
}
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Handle/SceneHandle.cs b/Assets/YooAsset/Runtime/ResourceManager/Handle/SceneHandle.cs
index 36f18904..ffe0914f 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/Handle/SceneHandle.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/Handle/SceneHandle.cs
@@ -116,7 +116,7 @@ namespace YooAsset
/// 异步卸载场景对象
/// 注意:场景卸载成功后,会自动释放该handle的引用计数!
///
- public UnloadSceneOperation UnloadAsync()
+ public UnloadSceneOperation UnloadSceneAsync()
{
string packageName = GetAssetInfo().PackageName;
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOperation.cs b/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOperation.cs
index 8807c66f..a2e0825d 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOperation.cs
@@ -14,12 +14,7 @@ namespace YooAsset
}
private readonly AssetHandle _handle;
- private readonly bool _setPositionAndRotation;
- private readonly Vector3 _position;
- private readonly Quaternion _rotation;
- private readonly Transform _parent;
- private readonly bool _worldPositionStays;
- private readonly bool _actived;
+ private readonly InstantiateOptions _options;
private ESteps _steps = ESteps.None;
#if UNITY_2023_3_OR_NEWER
@@ -32,16 +27,10 @@ namespace YooAsset
public GameObject Result = null;
- internal InstantiateOperation(AssetHandle handle, bool setPositionAndRotation, Vector3 position, Quaternion rotation,
- Transform parent, bool worldPositionStays, bool actived)
+ internal InstantiateOperation(AssetHandle handle, InstantiateOptions options)
{
_handle = handle;
- _setPositionAndRotation = setPositionAndRotation;
- _position = position;
- _rotation = rotation;
- _parent = parent;
- _worldPositionStays = worldPositionStays;
- _actived = actived;
+ _options = options;
}
internal override void InternalStart()
{
@@ -90,8 +79,8 @@ namespace YooAsset
if (_steps == ESteps.CloneSync)
{
// 实例化游戏对象
- Result = InstantiateInternal(_handle.AssetObject, _setPositionAndRotation, _position, _rotation, _parent, _worldPositionStays);
- if (_actived == false)
+ Result = InstantiateInternal(_handle.AssetObject, _options);
+ if (_options.Actived == false)
Result.SetActive(false);
_steps = ESteps.Done;
@@ -103,7 +92,7 @@ namespace YooAsset
{
if (_instantiateAsync == null)
{
- _instantiateAsync = InstantiateAsyncInternal(_handle.AssetObject, _setPositionAndRotation, _position, _rotation, _parent, _worldPositionStays);
+ _instantiateAsync = InstantiateAsyncInternal(_handle.AssetObject, _options);
}
if (IsWaitForAsyncComplete)
@@ -117,7 +106,7 @@ namespace YooAsset
Result = _instantiateAsync.Result[0] as GameObject;
if (Result != null)
{
- if (_actived == false)
+ if (_options.Actived == false)
Result.SetActive(false);
_steps = ESteps.Done;
@@ -165,22 +154,22 @@ namespace YooAsset
///
/// 同步实例化
///
- internal static GameObject InstantiateInternal(UnityEngine.Object assetObject, bool setPositionAndRotation, Vector3 position, Quaternion rotation, Transform parent, bool worldPositionStays)
+ internal static GameObject InstantiateInternal(UnityEngine.Object assetObject, InstantiateOptions options)
{
if (assetObject == null)
return null;
- if (setPositionAndRotation)
+ if (options.SetPositionAndRotation)
{
- if (parent != null)
- return UnityEngine.Object.Instantiate(assetObject as GameObject, position, rotation, parent);
+ if (options.Parent != null)
+ return UnityEngine.Object.Instantiate(assetObject as GameObject, options.Position, options.Rotation, options.Parent);
else
- return UnityEngine.Object.Instantiate(assetObject as GameObject, position, rotation);
+ return UnityEngine.Object.Instantiate(assetObject as GameObject, options.Position, options.Rotation);
}
else
{
- if (parent != null)
- return UnityEngine.Object.Instantiate(assetObject as GameObject, parent, worldPositionStays);
+ if (options.Parent != null)
+ return UnityEngine.Object.Instantiate(assetObject as GameObject, options.Parent, options.InWorldSpace);
else
return UnityEngine.Object.Instantiate(assetObject as GameObject);
}
@@ -192,19 +181,19 @@ namespace YooAsset
/// 注意:Unity2022.3.20f1及以上版本生效
/// https://docs.unity3d.com/2022.3/Documentation/ScriptReference/Object.InstantiateAsync.html
///
- internal static AsyncInstantiateOperation InstantiateAsyncInternal(UnityEngine.Object assetObject, bool setPositionAndRotation, Vector3 position, Quaternion rotation, Transform parent, bool worldPositionStays)
+ internal static AsyncInstantiateOperation InstantiateAsyncInternal(UnityEngine.Object assetObject, InstantiateOptions options)
{
- if (setPositionAndRotation)
+ if (options.SetPositionAndRotation)
{
- if (parent != null)
- return UnityEngine.Object.InstantiateAsync(assetObject as GameObject, parent, position, rotation);
+ if (options.Parent != null)
+ return UnityEngine.Object.InstantiateAsync(assetObject as GameObject, options.Parent, options.Position, options.Rotation);
else
- return UnityEngine.Object.InstantiateAsync(assetObject as GameObject, position, rotation);
+ return UnityEngine.Object.InstantiateAsync(assetObject as GameObject, options.Position, options.Rotation);
}
else
{
- if (parent != null)
- return UnityEngine.Object.InstantiateAsync(assetObject as GameObject, parent);
+ if (options.Parent != null)
+ return UnityEngine.Object.InstantiateAsync(assetObject as GameObject, options.Parent);
else
return UnityEngine.Object.InstantiateAsync(assetObject as GameObject);
}
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOptions.cs b/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOptions.cs
new file mode 100644
index 00000000..6cef708d
--- /dev/null
+++ b/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOptions.cs
@@ -0,0 +1,77 @@
+using UnityEngine;
+
+namespace YooAsset
+{
+ public struct InstantiateOptions
+ {
+ ///
+ /// 是否激活实例化对象
+ ///
+ public bool Actived { private set; get; }
+
+ ///
+ /// 将指定给新对象的父对象
+ ///
+ public Transform Parent { private set; get; }
+
+ ///
+ /// 分配父对象时, 定位新对象关系。
+ /// true 在世界空间中定位新对象。
+ /// false 相对于父对象来设置新对象。
+ ///
+ public bool InWorldSpace { private set; get; }
+
+ ///
+ /// 新对象的位置
+ ///
+ public Vector3 Position { private set; get; }
+
+ ///
+ /// 新对象的方向
+ ///
+ public Quaternion Rotation { private set; get; }
+
+ internal bool SetPositionAndRotation { private set; get; }
+
+ public InstantiateOptions(bool actived)
+ {
+ Actived = actived;
+ Parent = null;
+ InWorldSpace = false;
+
+ SetPositionAndRotation = false;
+ Position = Vector3.zero;
+ Rotation = Quaternion.identity;
+ }
+ public InstantiateOptions(bool actived, Transform parent, bool inWorldSpace)
+ {
+ Actived = actived;
+ Parent = parent;
+ InWorldSpace = inWorldSpace;
+
+ SetPositionAndRotation = false;
+ Position = Vector3.zero;
+ Rotation = Quaternion.identity;
+ }
+ public InstantiateOptions(bool actived, Transform parent, Vector3 position, Quaternion rotation)
+ {
+ Actived = actived;
+ Parent = parent;
+ InWorldSpace = false;
+
+ SetPositionAndRotation = true;
+ Position = position;
+ Rotation = rotation;
+ }
+ public InstantiateOptions(bool actived, Vector3 position, Quaternion rotation)
+ {
+ Actived = actived;
+ Parent = null;
+ InWorldSpace = false;
+
+ SetPositionAndRotation = true;
+ Position = position;
+ Rotation = rotation;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs.meta b/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOptions.cs.meta
similarity index 83%
rename from Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs.meta
rename to Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOptions.cs.meta
index 399ae723..7c74d45c 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs.meta
+++ b/Assets/YooAsset/Runtime/ResourceManager/Operation/InstantiateOptions.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 4629f36c31a96214b9057827c6a283cf
+guid: 7432581e3bde71648adef94499c7a398
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs b/Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleOperation.cs
similarity index 97%
rename from Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs
rename to Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleOperation.cs
index cb032bb7..480ce938 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleOperation.cs
@@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace YooAsset
{
- internal class LoadBundleFileOperation : AsyncOperationBase
+ internal class LoadBundleOperation : AsyncOperationBase
{
private enum ESteps
{
@@ -51,7 +51,7 @@ namespace YooAsset
public BundleResult Result { set; get; }
- internal LoadBundleFileOperation(ResourceManager resourceManager, BundleInfo bundleInfo)
+ internal LoadBundleOperation(ResourceManager resourceManager, BundleInfo bundleInfo)
{
_resManager = resourceManager;
LoadBundleInfo = bundleInfo;
@@ -85,7 +85,7 @@ namespace YooAsset
{
// 统计计数增加
_resManager.BundleLoadingCounter++;
- _loadBundleOp = LoadBundleInfo.LoadBundleFile();
+ _loadBundleOp = LoadBundleInfo.CreateBundleLoader();
_loadBundleOp.StartOperation();
AddChildOperation(_loadBundleOp);
}
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs.meta b/Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleOperation.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs.meta
rename to Assets/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleOperation.cs.meta
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOperation.cs b/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOperation.cs
index 5ab47cbd..43f6eb34 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOperation.cs
@@ -1,6 +1,5 @@
using System.Collections;
using System.Collections.Generic;
-using UnityEngine;
namespace YooAsset
{
@@ -14,19 +13,19 @@ namespace YooAsset
}
private readonly ResourceManager _resManager;
- private readonly int _loopCount;
+ private readonly UnloadUnusedAssetsOptions _options;
private int _loopCounter = 0;
private ESteps _steps = ESteps.None;
- internal UnloadUnusedAssetsOperation(ResourceManager resourceManager, int loopCount)
+ internal UnloadUnusedAssetsOperation(ResourceManager resourceManager, UnloadUnusedAssetsOptions options)
{
_resManager = resourceManager;
- _loopCount = loopCount;
+ _options = options;
}
internal override void InternalStart()
{
_steps = ESteps.UnloadUnused;
- _loopCounter = _loopCount;
+ _loopCounter = _options.LoopCount;
}
internal override void InternalUpdate()
{
@@ -57,7 +56,7 @@ namespace YooAsset
}
internal override string InternalGetDesc()
{
- return $"LoopCount : {_loopCount}";
+ return $"LoopCount : {_options.LoopCount}";
}
///
@@ -65,7 +64,7 @@ namespace YooAsset
///
private void LoopUnloadUnused()
{
- var removeList = new List(_resManager.LoaderDic.Count);
+ var removeList = new List(_resManager.LoaderDic.Count);
// 注意:优先销毁资源提供者
foreach (var loader in _resManager.LoaderDic.Values)
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOptions.cs b/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOptions.cs
new file mode 100644
index 00000000..0dec79a5
--- /dev/null
+++ b/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOptions.cs
@@ -0,0 +1,16 @@
+
+namespace YooAsset
+{
+ public struct UnloadUnusedAssetsOptions
+ {
+ ///
+ /// 循环迭代次数
+ ///
+ public int LoopCount { private set; get; }
+
+ public UnloadUnusedAssetsOptions(int loopCount)
+ {
+ LoopCount = loopCount;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/YooAssetsExtension.cs.meta b/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOptions.cs.meta
similarity index 83%
rename from Assets/YooAsset/Runtime/YooAssetsExtension.cs.meta
rename to Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOptions.cs.meta
index 68145ca3..4d7901b0 100644
--- a/Assets/YooAsset/Runtime/YooAssetsExtension.cs.meta
+++ b/Assets/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOptions.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 2db868c2aaaee8e42a7f035117e747c4
+guid: 33a033398461486429728fc87b8b9840
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/Assets/YooAsset/Runtime/ResourceManager/Provider/ProviderOperation.cs b/Assets/YooAsset/Runtime/ResourceManager/Provider/ProviderOperation.cs
index 74e2447e..08257af9 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/Provider/ProviderOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/Provider/ProviderOperation.cs
@@ -80,8 +80,8 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
protected readonly ResourceManager _resManager;
- private readonly LoadBundleFileOperation _mainBundleLoader;
- private readonly List _bundleLoaders = new List(10);
+ private readonly LoadBundleOperation _mainBundleLoader;
+ private readonly List _bundleLoaders = new List(10);
private readonly HashSet _handles = new HashSet();
public ProviderOperation(ResourceManager manager, string providerGUID, AssetInfo assetInfo)
diff --git a/Assets/YooAsset/Runtime/ResourceManager/ResourceManager.cs b/Assets/YooAsset/Runtime/ResourceManager/ResourceManager.cs
index f79cefa0..cb58ca32 100644
--- a/Assets/YooAsset/Runtime/ResourceManager/ResourceManager.cs
+++ b/Assets/YooAsset/Runtime/ResourceManager/ResourceManager.cs
@@ -10,12 +10,12 @@ namespace YooAsset
internal class ResourceManager
{
internal readonly Dictionary ProviderDic = new Dictionary(5000);
- internal readonly Dictionary LoaderDic = new Dictionary(5000);
+ internal readonly Dictionary LoaderDic = new Dictionary(5000);
internal readonly List SceneHandles = new List(100);
+ private FileSystemHost _fileSystemHost;
private long _sceneCreateIndex = 0;
- private IBundleQuery _bundleQuery;
private int _bundleLoadingMaxConcurrency;
-
+
// 开发者配置选项
public bool AutoUnloadBundleWhenUnused { private set; get; }
public bool WebGLForceSyncLoadAsset { private set; get; }
@@ -44,12 +44,12 @@ namespace YooAsset
///
/// 初始化
///
- public void Initialize(InitializePackageOptions options, IBundleQuery bundleServices)
+ public void Initialize(InitializePackageOptions options, FileSystemHost host)
{
+ _fileSystemHost = host;
_bundleLoadingMaxConcurrency = options.BundleLoadingMaxConcurrency;
AutoUnloadBundleWhenUnused = options.AutoUnloadBundleWhenUnused;
WebGLForceSyncLoadAsset = options.WebGLForceSyncLoadAsset;
- _bundleQuery = bundleServices;
SceneManager.sceneUnloaded += OnSceneUnloaded;
}
@@ -82,7 +82,7 @@ namespace YooAsset
loopCount--;
// 卸载主资源包加载器
- string mainBundleName = _bundleQuery.GetMainBundleName(assetInfo.Asset.BundleID);
+ string mainBundleName = _fileSystemHost.GetMainBundleName(assetInfo.Asset.BundleID);
var mainLoader = TryGetBundleFileLoader(mainBundleName);
if (mainLoader != null)
{
@@ -97,7 +97,7 @@ namespace YooAsset
// 卸载依赖资源包加载器
foreach (var dependID in assetInfo.Asset.DependBundleIDs)
{
- string dependBundleName = _bundleQuery.GetMainBundleName(dependID);
+ string dependBundleName = _fileSystemHost.GetMainBundleName(dependID);
var dependLoader = TryGetBundleFileLoader(dependBundleName);
if (dependLoader != null)
{
@@ -296,15 +296,15 @@ namespace YooAsset
return provider.CreateHandle();
}
- internal LoadBundleFileOperation CreateMainBundleFileLoader(AssetInfo assetInfo)
+ internal LoadBundleOperation CreateMainBundleFileLoader(AssetInfo assetInfo)
{
- BundleInfo bundleInfo = _bundleQuery.GetMainBundleInfo(assetInfo);
+ BundleInfo bundleInfo = _fileSystemHost.GetMainBundleInfo(assetInfo);
return CreateBundleFileLoaderInternal(bundleInfo);
}
- internal List CreateDependBundleFileLoaders(AssetInfo assetInfo)
+ internal List CreateDependBundleFileLoaders(AssetInfo assetInfo)
{
- List bundleInfos = _bundleQuery.GetDependBundleInfos(assetInfo);
- List result = new List(bundleInfos.Count);
+ List bundleInfos = _fileSystemHost.GetDependBundleInfos(assetInfo);
+ List result = new List(bundleInfos.Count);
foreach (var bundleInfo in bundleInfos)
{
var bundleLoader = CreateBundleFileLoaderInternal(bundleInfo);
@@ -321,7 +321,7 @@ namespace YooAsset
}
internal bool CheckBundleDestroyed(int bundleID)
{
- string bundleName = _bundleQuery.GetMainBundleName(bundleID);
+ string bundleName = _fileSystemHost.GetMainBundleName(bundleID);
var bundleFileLoader = TryGetBundleFileLoader(bundleName);
if (bundleFileLoader == null)
return true;
@@ -329,7 +329,7 @@ namespace YooAsset
}
internal bool CheckBundleReleasable(int bundleID)
{
- string bundleName = _bundleQuery.GetMainBundleName(bundleID);
+ string bundleName = _fileSystemHost.GetMainBundleName(bundleID);
var bundleFileLoader = TryGetBundleFileLoader(bundleName);
if (bundleFileLoader == null)
return true;
@@ -344,22 +344,22 @@ namespace YooAsset
return BundleLoadingCounter >= _bundleLoadingMaxConcurrency;
}
- private LoadBundleFileOperation CreateBundleFileLoaderInternal(BundleInfo bundleInfo)
+ private LoadBundleOperation CreateBundleFileLoaderInternal(BundleInfo bundleInfo)
{
// 如果加载器已经存在
string bundleName = bundleInfo.Bundle.BundleName;
- LoadBundleFileOperation loaderOperation = TryGetBundleFileLoader(bundleName);
+ LoadBundleOperation loaderOperation = TryGetBundleFileLoader(bundleName);
if (loaderOperation != null)
return loaderOperation;
// 新增下载需求
- loaderOperation = new LoadBundleFileOperation(this, bundleInfo);
+ loaderOperation = new LoadBundleOperation(this, bundleInfo);
LoaderDic.Add(bundleName, loaderOperation);
return loaderOperation;
}
- private LoadBundleFileOperation TryGetBundleFileLoader(string bundleName)
+ private LoadBundleOperation TryGetBundleFileLoader(string bundleName)
{
- if (LoaderDic.TryGetValue(bundleName, out LoadBundleFileOperation value))
+ if (LoaderDic.TryGetValue(bundleName, out LoadBundleOperation value))
return value;
else
return null;
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs b/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
index db6a158d..9d29ef58 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
@@ -26,21 +26,22 @@ namespace YooAsset
}
///
- /// 加载资源包
+ /// 创建加载器
///
- public FSLoadBundleOperation LoadBundleFile()
+ public FSLoadBundleOperation CreateBundleLoader()
{
- return _fileSystem.LoadBundleFile(Bundle);
+ var options = new LoadBundleOptions(Bundle);
+ return _fileSystem.LoadBundleAsync(options);
}
///
/// 创建下载器
///
- public FSDownloadFileOperation CreateDownloader(int failedTryAgain)
+ public FSDownloadFileOperation CreateBundleDownloader(int failedTryAgain)
{
- DownloadFileOptions options = new DownloadFileOptions(failedTryAgain);
+ DownloadFileOptions options = new DownloadFileOptions(Bundle, failedTryAgain);
options.ImportFilePath = _importFilePath;
- return _fileSystem.DownloadFileAsync(Bundle, options);
+ return _fileSystem.DownloadFileAsync(options);
}
///
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/EBuildBundleType.cs b/Assets/YooAsset/Runtime/ResourcePackage/EBundleType.cs
similarity index 94%
rename from Assets/YooAsset/Runtime/ResourcePackage/EBuildBundleType.cs
rename to Assets/YooAsset/Runtime/ResourcePackage/EBundleType.cs
index 5ec8b48e..e67e72dd 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/EBuildBundleType.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/EBundleType.cs
@@ -1,7 +1,7 @@
namespace YooAsset
{
- public enum EBuildBundleType
+ public enum EBundleType
{
///
/// 未知类型
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/EBuildBundleType.cs.meta b/Assets/YooAsset/Runtime/ResourcePackage/EBundleType.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/ResourcePackage/EBuildBundleType.cs.meta
rename to Assets/YooAsset/Runtime/ResourcePackage/EBundleType.cs.meta
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs b/Assets/YooAsset/Runtime/ResourcePackage/FileSystemHost.cs
similarity index 73%
rename from Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs
rename to Assets/YooAsset/Runtime/ResourcePackage/FileSystemHost.cs
index cedaba11..767f548b 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/FileSystemHost.cs
@@ -4,12 +4,18 @@ using System.Collections.Generic;
namespace YooAsset
{
- internal class PlayModeImpl : IPlayMode, IBundleQuery
+ internal class FileSystemHost
{
public readonly string PackageName;
public readonly List FileSystems = new List(10);
- public PlayModeImpl(string packageName)
+ ///
+ /// 当前激活的清单
+ ///
+ public PackageManifest ActiveManifest { set; get; }
+
+
+ public FileSystemHost(string packageName)
{
PackageName = packageName;
}
@@ -47,16 +53,10 @@ namespace YooAsset
return operation;
}
- #region IPlayMode接口
- ///
- /// 当前激活的清单
- ///
- public PackageManifest ActiveManifest { set; get; }
-
///
/// 销毁文件系统
///
- void IPlayMode.DestroyFileSystem()
+ public void Destroy()
{
foreach (var fileSystem in FileSystems)
{
@@ -65,92 +65,7 @@ namespace YooAsset
FileSystems.Clear();
}
- ///
- /// 向网络端请求最新的资源版本
- ///
- RequestPackageVersionOperation IPlayMode.RequestPackageVersionAsync(RequestPackageVersionOptions options)
- {
- var operation = new RequestPackageVersionImplOperation(this, options);
- return operation;
- }
-
- ///
- /// 向网络端请求并更新清单
- ///
- LoadPackageManifestOperation IPlayMode.LoadPackageManifestAsync(LoadPackageManifestOptions options)
- {
- var operation = new LoadPackageManifestOperation(this, options);
- return operation;
- }
-
- ///
- /// 预下载指定版本的包裹内容
- ///
- PreDownloadContentOperation IPlayMode.PreDownloadContentAsync(PreDownloadContentOptions options)
- {
- var operation = new PreDownloadContentOperation(this, options);
- return operation;
- }
-
- ///
- /// 清理缓存文件
- ///
- ClearCacheFilesOperation IPlayMode.ClearCacheFilesAsync(ClearCacheFilesOptions options)
- {
- var operation = new ClearCacheFilesOperation(this, options);
- return operation;
- }
-
- // 下载相关
- ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain)
- {
- List downloadList = GetDownloadListByAll(ActiveManifest);
- var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
- return operation;
- }
- ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain)
- {
- List downloadList = GetDownloadListByTags(ActiveManifest, tags);
- var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
- return operation;
- }
- ResourceDownloaderOperation IPlayMode.CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain)
- {
- List downloadList = GetDownloadListByPaths(ActiveManifest, assetInfos, recursiveDownload);
- var operation = new ResourceDownloaderOperation(PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
- return operation;
- }
-
- // 解压相关
- ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain)
- {
- List unpcakList = GetUnpackListByAll(ActiveManifest);
- var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain);
- return operation;
- }
- ResourceUnpackerOperation IPlayMode.CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain)
- {
- List unpcakList = GetUnpackListByTags(ActiveManifest, tags);
- var operation = new ResourceUnpackerOperation(PackageName, unpcakList, upackingMaxNumber, failedTryAgain);
- return operation;
- }
-
- // 导入相关
- ResourceImporterOperation IPlayMode.CreateResourceImporterByFilePaths(string[] filePaths, int importingMaxNumber, int failedTryAgain)
- {
- List importerList = GetImporterListByFilePaths(ActiveManifest, filePaths);
- var operation = new ResourceImporterOperation(PackageName, importerList, importingMaxNumber, failedTryAgain);
- return operation;
- }
- ResourceImporterOperation IPlayMode.CreateResourceImporterByFileInfos(ImportFileInfo[] fileInfos, int importingMaxNumber, int failedTryAgain)
- {
- List importerList = GetImporterListByFileInfos(ActiveManifest, fileInfos);
- var operation = new ResourceImporterOperation(PackageName, importerList, importingMaxNumber, failedTryAgain);
- return operation;
- }
- #endregion
-
- #region IBundleQuery接口
+ #region 资源包相关
private BundleInfo CreateBundleInfo(PackageBundle packageBundle)
{
if (packageBundle == null)
@@ -165,7 +80,11 @@ namespace YooAsset
throw new YooFileSystemException($"Can not found belong file system : {packageBundle.BundleName}");
}
- BundleInfo IBundleQuery.GetMainBundleInfo(AssetInfo assetInfo)
+
+ ///
+ /// 获取主资源包信息
+ ///
+ public BundleInfo GetMainBundleInfo(AssetInfo assetInfo)
{
if (assetInfo == null || assetInfo.IsInvalid)
throw new YooInternalException();
@@ -174,7 +93,21 @@ namespace YooAsset
var packageBundle = ActiveManifest.GetMainPackageBundle(assetInfo.Asset);
return CreateBundleInfo(packageBundle);
}
- List IBundleQuery.GetDependBundleInfos(AssetInfo assetInfo)
+
+ ///
+ /// 获取主资源包名称
+ ///
+ public string GetMainBundleName(int bundleID)
+ {
+ // 注意:如果清单里未找到资源包会抛出异常!
+ var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
+ return packageBundle.BundleName;
+ }
+
+ ///
+ /// 获取依赖的资源包信息集合
+ ///
+ public List GetDependBundleInfos(AssetInfo assetInfo)
{
if (assetInfo == null || assetInfo.IsInvalid)
throw new YooInternalException();
@@ -199,45 +132,50 @@ namespace YooAsset
}
return result;
}
- string IBundleQuery.GetMainBundleName(int bundleID)
- {
- // 注意:如果清单里未找到资源包会抛出异常!
- var packageBundle = ActiveManifest.GetMainPackageBundle(bundleID);
- return packageBundle.BundleName;
- }
#endregion
- ///
- /// 获取主文件系统
- /// 说明:文件系统列表里,最后一个属于主文件系统
- ///
- public IFileSystem GetMainFileSystem()
+ #region 下载器相关
+ public ResourceDownloaderOperation CreateResourceDownloader(ResourceDownloaderOptions options)
{
- int count = FileSystems.Count;
- if (count == 0)
- return null;
- return FileSystems[count - 1];
+ List downloadList;
+ if (options.Tags == null)
+ downloadList = GetDownloadListByAll(ActiveManifest);
+ else
+ downloadList = GetDownloadListByTags(ActiveManifest, options.Tags);
+
+ var operation = new ResourceDownloaderOperation(PackageName, downloadList, options.MaximumConcurrency, options.FailedTryAgain);
+ return operation;
+ }
+ public ResourceDownloaderOperation CreateResourceDownloader(BundleDownloaderOptions options)
+ {
+ List downloadList;
+ if (options.AssetInfos == null)
+ downloadList = GetDownloadListByAll(ActiveManifest);
+ else
+ downloadList = GetDownloadListByAssetInfos(ActiveManifest, options.AssetInfos, options.DownloadBundleDependencies);
+
+ var operation = new ResourceDownloaderOperation(PackageName, downloadList, options.MaximumConcurrency, options.FailedTryAgain);
+ return operation;
+ }
+ public ResourceUnpackerOperation CreateResourceUnpacker(ResourceUnpackerOptions options)
+ {
+ List unpcakList;
+ if (options.Tags == null)
+ unpcakList = GetUnpackListByAll(ActiveManifest);
+ else
+ unpcakList = GetUnpackListByTags(ActiveManifest, options.Tags);
+
+ var operation = new ResourceUnpackerOperation(PackageName, unpcakList, options.MaximumConcurrency, options.FailedTryAgain);
+ return operation;
+ }
+ public ResourceImporterOperation CreateResourceImporter(BundleImporterOptions options)
+ {
+ List importerList = GetImporterListByBundleInfos(ActiveManifest, options.BundleInfos);
+ var operation = new ResourceImporterOperation(PackageName, importerList, options.MaximumConcurrency, options.FailedTryAgain);
+ return operation;
}
- ///
- /// 获取资源包所属文件系统
- ///
- public IFileSystem GetBelongFileSystem(PackageBundle packageBundle)
- {
- for (int i = 0; i < FileSystems.Count; i++)
- {
- IFileSystem fileSystem = FileSystems[i];
- if (fileSystem.Belong(packageBundle))
- {
- return fileSystem;
- }
- }
-
- YooLogger.Error($"Can not found belong file system : {packageBundle.BundleName}");
- return null;
- }
-
- public List GetDownloadListByAll(PackageManifest manifest)
+ internal List GetDownloadListByAll(PackageManifest manifest)
{
if (manifest == null)
return new List();
@@ -257,7 +195,7 @@ namespace YooAsset
}
return result;
}
- public List GetDownloadListByTags(PackageManifest manifest, string[] tags)
+ internal List GetDownloadListByTags(PackageManifest manifest, string[] tags)
{
if (manifest == null)
return new List();
@@ -290,7 +228,7 @@ namespace YooAsset
}
return result;
}
- public List GetDownloadListByPaths(PackageManifest manifest, AssetInfo[] assetInfos, bool recursiveDownload)
+ internal List GetDownloadListByAssetInfos(PackageManifest manifest, AssetInfo[] assetInfos, bool recursiveDownload)
{
if (manifest == null)
return new List();
@@ -365,7 +303,7 @@ namespace YooAsset
}
return result;
}
- public List GetUnpackListByAll(PackageManifest manifest)
+ internal List GetUnpackListByAll(PackageManifest manifest)
{
if (manifest == null)
return new List();
@@ -385,7 +323,7 @@ namespace YooAsset
}
return result;
}
- public List GetUnpackListByTags(PackageManifest manifest, string[] tags)
+ internal List GetUnpackListByTags(PackageManifest manifest, string[] tags)
{
if (manifest == null)
return new List();
@@ -408,22 +346,7 @@ namespace YooAsset
}
return result;
}
- public List GetImporterListByFilePaths(PackageManifest manifest, string[] filePaths)
- {
- if (manifest == null)
- return new List();
-
- ImportFileInfo[] fileInfos = new ImportFileInfo[filePaths.Length];
- for (int i = 0; i < filePaths.Length; i++)
- {
- ImportFileInfo fileInfo = new ImportFileInfo();
- fileInfo.FilePath = filePaths[i];
- fileInfos[i] = fileInfo;
- }
-
- return GetImporterListByFileInfos(manifest, fileInfos);
- }
- public List GetImporterListByFileInfos(PackageManifest manifest, ImportFileInfo[] fileInfos)
+ internal List GetImporterListByBundleInfos(PackageManifest manifest, ImportBundleInfo[] fileInfos)
{
if (manifest == null)
return new List();
@@ -477,5 +400,36 @@ namespace YooAsset
}
return result;
}
+ #endregion
+
+ ///
+ /// 获取主文件系统
+ /// 说明:文件系统列表里,最后一个属于主文件系统
+ ///
+ public IFileSystem GetMainFileSystem()
+ {
+ int count = FileSystems.Count;
+ if (count == 0)
+ return null;
+ return FileSystems[count - 1];
+ }
+
+ ///
+ /// 获取资源包所属文件系统
+ ///
+ public IFileSystem GetBelongFileSystem(PackageBundle packageBundle)
+ {
+ for (int i = 0; i < FileSystems.Count; i++)
+ {
+ IFileSystem fileSystem = FileSystems[i];
+ if (fileSystem.Belong(packageBundle))
+ {
+ return fileSystem;
+ }
+ }
+
+ YooLogger.Error($"Can not found belong file system : {packageBundle.BundleName}");
+ return null;
+ }
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs.meta b/Assets/YooAsset/Runtime/ResourcePackage/FileSystemHost.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs.meta
rename to Assets/YooAsset/Runtime/ResourcePackage/FileSystemHost.cs.meta
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Interface.meta b/Assets/YooAsset/Runtime/ResourcePackage/Interface.meta
deleted file mode 100644
index 8643af0d..00000000
--- a/Assets/YooAsset/Runtime/ResourcePackage/Interface.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: e7f5776546411834d9ed949d54a6f241
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IBundleQuery.cs b/Assets/YooAsset/Runtime/ResourcePackage/Interface/IBundleQuery.cs
deleted file mode 100644
index 2906c7f0..00000000
--- a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IBundleQuery.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.Collections;
-using System.Collections.Generic;
-
-namespace YooAsset
-{
- internal interface IBundleQuery
- {
- ///
- /// 获取主资源包信息
- ///
- BundleInfo GetMainBundleInfo(AssetInfo assetInfo);
-
- ///
- /// 获取依赖的资源包信息集合
- ///
- List GetDependBundleInfos(AssetInfo assetPath);
-
- ///
- /// 获取主资源包名称
- ///
- string GetMainBundleName(int bundleID);
- }
-}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs b/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs
deleted file mode 100644
index 7d706e41..00000000
--- a/Assets/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs
+++ /dev/null
@@ -1,49 +0,0 @@
-
-namespace YooAsset
-{
- internal interface IPlayMode
- {
- ///
- /// 当前激活的清单
- ///
- PackageManifest ActiveManifest { set; get; }
-
- ///
- /// 销毁文件系统
- ///
- void DestroyFileSystem();
-
- ///
- /// 请求最新的资源版本
- ///
- RequestPackageVersionOperation RequestPackageVersionAsync(RequestPackageVersionOptions options);
-
- ///
- /// 请求并加载资源清单
- ///
- LoadPackageManifestOperation LoadPackageManifestAsync(LoadPackageManifestOptions options);
-
- ///
- /// 预下载指定版本的包裹内容
- ///
- PreDownloadContentOperation PreDownloadContentAsync(PreDownloadContentOptions options);
-
- ///
- /// 清理缓存文件
- ///
- ClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options);
-
- // 下载相关
- ResourceDownloaderOperation CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain);
- ResourceDownloaderOperation CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain);
- ResourceDownloaderOperation CreateResourceDownloaderByPaths(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain);
-
- // 解压相关
- ResourceUnpackerOperation CreateResourceUnpackerByAll(int upackingMaxNumber, int failedTryAgain);
- ResourceUnpackerOperation CreateResourceUnpackerByTags(string[] tags, int upackingMaxNumber, int failedTryAgain);
-
- // 导入相关
- ResourceImporterOperation CreateResourceImporterByFilePaths(string[] filePaths, int importingMaxNumber, int failedTryAgain);
- ResourceImporterOperation CreateResourceImporterByFileInfos(ImportFileInfo[] fileInfos, int importingMaxNumber, int failedTryAgain);
- }
-}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOperation.cs
index abcd0b9e..38fcf009 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOperation.cs
@@ -14,15 +14,15 @@ namespace YooAsset
Done,
}
- private readonly PlayModeImpl _impl;
+ private readonly FileSystemHost _host;
private readonly ClearCacheFilesOptions _options;
private List _cloneList;
private FSClearCacheFilesOperation _clearCacheFilesOp;
private ESteps _steps = ESteps.None;
- internal ClearCacheFilesOperation(PlayModeImpl impl, ClearCacheFilesOptions options)
+ internal ClearCacheFilesOperation(FileSystemHost host, ClearCacheFilesOptions options)
{
- _impl = impl;
+ _host = host;
_options = options;
}
internal override void InternalStart()
@@ -36,7 +36,7 @@ namespace YooAsset
if (_steps == ESteps.Prepare)
{
- var fileSytems = _impl.FileSystems;
+ var fileSytems = _host.FileSystems;
if (fileSytems == null || fileSytems.Count == 0)
{
_steps = ESteps.Done;
@@ -72,7 +72,7 @@ namespace YooAsset
var fileSystem = _cloneList[0];
_cloneList.RemoveAt(0);
- _clearCacheFilesOp = fileSystem.ClearCacheFilesAsync(_impl.ActiveManifest, _options);
+ _clearCacheFilesOp = fileSystem.ClearCacheFilesAsync(_options);
_clearCacheFilesOp.StartOperation();
AddChildOperation(_clearCacheFilesOp);
_steps = ESteps.CheckClearResult;
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOptions.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOptions.cs
index 4d8359dd..4b49ccad 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOptions.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOptions.cs
@@ -13,20 +13,28 @@ namespace YooAsset
///
public object ClearParam { private set; get; }
+ ///
+ /// 资源清单
+ ///
+ internal PackageManifest Manifest { set; get; }
+
public ClearCacheFilesOptions(EFileClearMode clearMode)
{
ClearMode = clearMode.ToString();
ClearParam = null;
+ Manifest = null;
}
public ClearCacheFilesOptions(EFileClearMode clearMode, object clearParam)
{
ClearMode = clearMode.ToString();
ClearParam = clearParam;
+ Manifest = null;
}
public ClearCacheFilesOptions(string clearMode, object clearParam)
{
ClearMode = clearMode;
ClearParam = clearParam;
+ Manifest = null;
}
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderDefine.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderDefine.cs
new file mode 100644
index 00000000..017575ce
--- /dev/null
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderDefine.cs
@@ -0,0 +1,102 @@
+
+namespace YooAsset
+{
+ ///
+ /// 下载器结束
+ ///
+ public struct DownloaderFinishData
+ {
+ ///
+ /// 所属包裹名称
+ ///
+ public string PackageName;
+
+ ///
+ /// 是否成功
+ ///
+ public bool Succeed;
+ }
+
+ ///
+ /// 下载器相关的更新数据
+ ///
+ public struct DownloadUpdateData
+ {
+ ///
+ /// 所属包裹名称
+ ///
+ public string PackageName;
+
+ ///
+ /// 下载进度 (0-1f)
+ ///
+ public float Progress;
+
+ ///
+ /// 下载文件总数
+ ///
+ public int TotalDownloadCount;
+
+ ///
+ /// 当前完成的下载文件数量
+ ///
+ public int CurrentDownloadCount;
+
+ ///
+ /// 下载数据总大小(单位:字节)
+ ///
+ public long TotalDownloadBytes;
+
+ ///
+ /// 当前完成的下载数据大小(单位:字节)
+ ///
+ public long CurrentDownloadBytes;
+ }
+
+ ///
+ /// 下载器相关的错误数据
+ ///
+ public struct DownloadErrorData
+ {
+ ///
+ /// 所属包裹名称
+ ///
+ public string PackageName;
+
+ ///
+ /// 下载失败的文件名称
+ ///
+ public string FileName;
+
+ ///
+ /// 错误信息
+ ///
+ public string ErrorInfo;
+ }
+
+ ///
+ /// 下载器相关的文件数据
+ ///
+ public struct DownloadFileData
+ {
+ ///
+ /// 所属包裹名称
+ ///
+ public string PackageName;
+
+ ///
+ /// 资源包名称
+ ///
+ public string BundleName;
+
+ ///
+ /// 文件名称
+ ///
+ public string FileName;
+
+ ///
+ /// 文件大小
+ ///
+ public long FileSize;
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderDefine.cs.meta b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderDefine.cs.meta
new file mode 100644
index 00000000..1a834b58
--- /dev/null
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderDefine.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 0a798eb87a00a284189bb69a767d2c02
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs
index fa39a055..872a75cc 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOperation.cs
@@ -3,107 +3,6 @@ using System.Collections.Generic;
namespace YooAsset
{
- #region 下载器相关类型定义
- ///
- /// 下载器结束
- ///
- public struct DownloaderFinishData
- {
- ///
- /// 所属包裹名称
- ///
- public string PackageName;
-
- ///
- /// 是否成功
- ///
- public bool Succeed;
- }
-
- ///
- /// 下载器相关的更新数据
- ///
- public struct DownloadUpdateData
- {
- ///
- /// 所属包裹名称
- ///
- public string PackageName;
-
- ///
- /// 下载进度 (0-1f)
- ///
- public float Progress;
-
- ///
- /// 下载文件总数
- ///
- public int TotalDownloadCount;
-
- ///
- /// 当前完成的下载文件数量
- ///
- public int CurrentDownloadCount;
-
- ///
- /// 下载数据总大小(单位:字节)
- ///
- public long TotalDownloadBytes;
-
- ///
- /// 当前完成的下载数据大小(单位:字节)
- ///
- public long CurrentDownloadBytes;
- }
-
- ///
- /// 下载器相关的错误数据
- ///
- public struct DownloadErrorData
- {
- ///
- /// 所属包裹名称
- ///
- public string PackageName;
-
- ///
- /// 下载失败的文件名称
- ///
- public string FileName;
-
- ///
- /// 错误信息
- ///
- public string ErrorInfo;
- }
-
- ///
- /// 下载器相关的文件数据
- ///
- public struct DownloadFileData
- {
- ///
- /// 所属包裹名称
- ///
- public string PackageName;
-
- ///
- /// 资源包名称
- ///
- public string BundleName;
-
- ///
- /// 文件名称
- ///
- public string FileName;
-
- ///
- /// 文件大小
- ///
- public long FileSize;
- }
- #endregion
-
public abstract class DownloaderOperation : AsyncOperationBase
{
private enum ESteps
@@ -140,7 +39,7 @@ namespace YooAsset
#endregion
private readonly string _packageName;
- private readonly int _downloadingMaxNumber;
+ private readonly int _maximumConcurrency;
private readonly int _failedTryAgain;
private readonly List _bundleInfoList;
private readonly List _downloaders = new List(MAX_LOADER_COUNT);
@@ -203,11 +102,11 @@ namespace YooAsset
public DownloadFileBegin DownloadFileBeginCallback { set; get; }
- internal DownloaderOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain)
+ internal DownloaderOperation(string packageName, List downloadList, int maximumConcurrency, int failedTryAgain)
{
_packageName = packageName;
_bundleInfoList = downloadList;
- _downloadingMaxNumber = UnityEngine.Mathf.Clamp(downloadingMaxNumber, 1, MAX_LOADER_COUNT); ;
+ _maximumConcurrency = UnityEngine.Mathf.Clamp(maximumConcurrency, 1, MAX_LOADER_COUNT); ;
_failedTryAgain = failedTryAgain;
// 统计下载信息
@@ -321,11 +220,11 @@ namespace YooAsset
if (_isPause)
return;
- if (_downloaders.Count < _downloadingMaxNumber)
+ if (_downloaders.Count < _maximumConcurrency)
{
int index = _bundleInfoList.Count - 1;
var bundleInfo = _bundleInfoList[index];
- var downloader = bundleInfo.CreateDownloader(_failedTryAgain);
+ var downloader = bundleInfo.CreateBundleDownloader(_failedTryAgain);
downloader.StartOperation();
this.AddChildOperation(downloader);
@@ -502,25 +401,25 @@ namespace YooAsset
public sealed class ResourceDownloaderOperation : DownloaderOperation
{
- internal ResourceDownloaderOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain)
- : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
+ internal ResourceDownloaderOperation(string packageName, List downloadList, int maximumConcurrency, int failedTryAgain)
+ : base(packageName, downloadList, maximumConcurrency, failedTryAgain)
{
}
///
/// 创建空的下载器
///
- internal static ResourceDownloaderOperation CreateEmptyDownloader(string packageName, int downloadingMaxNumber, int failedTryAgain)
+ internal static ResourceDownloaderOperation CreateEmptyDownloader(string packageName, int maximumConcurrency, int failedTryAgain)
{
List downloadList = new List();
- var operation = new ResourceDownloaderOperation(packageName, downloadList, downloadingMaxNumber, failedTryAgain);
+ var operation = new ResourceDownloaderOperation(packageName, downloadList, maximumConcurrency, failedTryAgain);
return operation;
}
}
public sealed class ResourceUnpackerOperation : DownloaderOperation
{
- internal ResourceUnpackerOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain)
- : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
+ internal ResourceUnpackerOperation(string packageName, List downloadList, int maximumConcurrency, int failedTryAgain)
+ : base(packageName, downloadList, maximumConcurrency, failedTryAgain)
{
}
@@ -536,8 +435,8 @@ namespace YooAsset
}
public sealed class ResourceImporterOperation : DownloaderOperation
{
- internal ResourceImporterOperation(string packageName, List downloadList, int downloadingMaxNumber, int failedTryAgain)
- : base(packageName, downloadList, downloadingMaxNumber, failedTryAgain)
+ internal ResourceImporterOperation(string packageName, List downloadList, int maximumConcurrency, int failedTryAgain)
+ : base(packageName, downloadList, maximumConcurrency, failedTryAgain)
{
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOptions.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOptions.cs
new file mode 100644
index 00000000..52f56cf2
--- /dev/null
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOptions.cs
@@ -0,0 +1,155 @@
+
+namespace YooAsset
+{
+ ///
+ /// 资源下载选项
+ ///
+ public struct BundleDownloaderOptions
+ {
+ ///
+ /// 最大并发数量
+ ///
+ public int MaximumConcurrency { private set; get; }
+
+ ///
+ /// 失败后的重试次数
+ ///
+ public int FailedTryAgain { private set; get; }
+
+ ///
+ /// 下载资源对象所属资源包内所有资源对象依赖的资源包
+ ///
+ public bool DownloadBundleDependencies { private set; get; }
+
+ ///
+ /// 资源信息列表
+ /// 说明:如果列表为NULL,则下载所有资产
+ ///
+ public AssetInfo[] AssetInfos { private set; get; }
+
+ public BundleDownloaderOptions(AssetInfo assetInfo, bool downloadDependencies, int maximumConcurrency, int failedTryAgain)
+ {
+ AssetInfos = new AssetInfo[] { assetInfo };
+ DownloadBundleDependencies = downloadDependencies;
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ public BundleDownloaderOptions(AssetInfo[] assetInfos, bool downloadDependencies, int maximumConcurrency, int failedTryAgain)
+ {
+ AssetInfos = assetInfos;
+ DownloadBundleDependencies = downloadDependencies;
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ }
+
+ ///
+ /// 资源下载选项
+ ///
+ public struct ResourceDownloaderOptions
+ {
+ ///
+ /// 最大并发数量
+ ///
+ public int MaximumConcurrency { private set; get; }
+
+ ///
+ /// 失败后的重试次数
+ ///
+ public int FailedTryAgain { private set; get; }
+
+ ///
+ /// 资源标签列表
+ /// 说明:如果列表为NULL,则下载所有资产
+ ///
+ public string[] Tags { private set; get; }
+
+ public ResourceDownloaderOptions(int maximumConcurrency, int failedTryAgain)
+ {
+ Tags = null;
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ public ResourceDownloaderOptions(string tag, int maximumConcurrency, int failedTryAgain)
+ {
+ Tags = new string[] { tag };
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ public ResourceDownloaderOptions(string[] tags, int maximumConcurrency, int failedTryAgain)
+ {
+ Tags = tags;
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ }
+
+ ///
+ /// 资源解压选项
+ ///
+ public struct ResourceUnpackerOptions
+ {
+ ///
+ /// 最大并发数量
+ ///
+ public int MaximumConcurrency { private set; get; }
+
+ ///
+ /// 失败后的重试次数
+ ///
+ public int FailedTryAgain { private set; get; }
+
+ ///
+ /// 资源标签列表
+ /// 说明:如果列表为NULL,则解压所有资产
+ ///
+ public string[] Tags { private set; get; }
+
+ public ResourceUnpackerOptions(int maximumConcurrency, int failedTryAgain)
+ {
+ Tags = null;
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ public ResourceUnpackerOptions(string tag, int maximumConcurrency, int failedTryAgain)
+ {
+ Tags = new string[] { tag };
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ public ResourceUnpackerOptions(string[] tags, int maximumConcurrency, int failedTryAgain)
+ {
+ Tags = tags;
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ }
+
+ ///
+ /// 资源导入选项
+ ///
+ public struct BundleImporterOptions
+ {
+ ///
+ /// 最大并发数量
+ ///
+ public int MaximumConcurrency { private set; get; }
+
+ ///
+ /// 失败后的重试次数
+ ///
+ public int FailedTryAgain { private set; get; }
+
+ ///
+ /// 资源包信息列表
+ ///
+ public ImportBundleInfo[] BundleInfos { private set; get; }
+
+ public BundleImporterOptions(ImportBundleInfo[] bundleInfos, int maximumConcurrency, int failedTryAgain)
+ {
+ BundleInfos = bundleInfos;
+ MaximumConcurrency = maximumConcurrency;
+ FailedTryAgain = failedTryAgain;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOptions.cs.meta b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOptions.cs.meta
new file mode 100644
index 00000000..882bf6fc
--- /dev/null
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/DownloaderOptions.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2567b73a071bdc14884214cb5e3b5cc0
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializePackageOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializePackageOperation.cs
index 03439945..f9df2e30 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializePackageOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/InitializePackageOperation.cs
@@ -17,7 +17,7 @@ namespace YooAsset
private readonly ResourcePackage _package;
private readonly InitializePackageOptions _options;
- private PlayModeImpl _playModeImpl;
+ private FileSystemHost _fileSystemHost;
private InitializeFileSystemOperation _initializeFileSystemOp;
private EPlayMode _playMode;
private ESteps _steps = ESteps.None;
@@ -118,12 +118,11 @@ namespace YooAsset
{
string packageName = _package.PackageName;
var resourceManager = new ResourceManager(packageName);
- var playModeImpl = new PlayModeImpl(packageName);
- resourceManager.Initialize(_options, playModeImpl);
+ var fileSystemHost = new FileSystemHost(packageName);
+ resourceManager.Initialize(_options, fileSystemHost);
- _playModeImpl = playModeImpl;
- _package._bundleQuery = playModeImpl;
- _package._playModeImpl = playModeImpl;
+ _fileSystemHost = fileSystemHost;
+ _package._fileSystemHost = fileSystemHost;
_package._resourceManager = resourceManager;
_steps = ESteps.InitFileSystem;
}
@@ -135,27 +134,27 @@ namespace YooAsset
if (_playMode == EPlayMode.EditorSimulateMode)
{
var initializeParameters = _options as EditorSimulateModeOptions;
- _initializeFileSystemOp = _playModeImpl.InitializeAsync(initializeParameters.EditorFileSystemParameters);
+ _initializeFileSystemOp = _fileSystemHost.InitializeAsync(initializeParameters.EditorFileSystemParameters);
}
else if (_playMode == EPlayMode.OfflinePlayMode)
{
var initializeParameters = _options as OfflinePlayModeOptions;
- _initializeFileSystemOp = _playModeImpl.InitializeAsync(initializeParameters.BuildinFileSystemParameters);
+ _initializeFileSystemOp = _fileSystemHost.InitializeAsync(initializeParameters.BuildinFileSystemParameters);
}
else if (_playMode == EPlayMode.HostPlayMode)
{
var initializeParameters = _options as HostPlayModeOptions;
- _initializeFileSystemOp = _playModeImpl.InitializeAsync(initializeParameters.BuildinFileSystemParameters, initializeParameters.CacheFileSystemParameters);
+ _initializeFileSystemOp = _fileSystemHost.InitializeAsync(initializeParameters.BuildinFileSystemParameters, initializeParameters.CacheFileSystemParameters);
}
else if (_playMode == EPlayMode.WebPlayMode)
{
var initializeParameters = _options as WebPlayModeOptions;
- _initializeFileSystemOp = _playModeImpl.InitializeAsync(initializeParameters.WebServerFileSystemParameters, initializeParameters.WebRemoteFileSystemParameters);
+ _initializeFileSystemOp = _fileSystemHost.InitializeAsync(initializeParameters.WebServerFileSystemParameters, initializeParameters.WebRemoteFileSystemParameters);
}
else if (_playMode == EPlayMode.CustomPlayMode)
{
var initializeParameters = _options as CustomPlayModeOptions;
- _initializeFileSystemOp = _playModeImpl.InitializeAsync(initializeParameters.FileSystemParameterList);
+ _initializeFileSystemOp = _fileSystemHost.InitializeAsync(initializeParameters.FileSystemParameterList);
}
else
{
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/Internal/DeserializeManifestOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/Internal/DeserializeManifestOperation.cs
index e7b1a455..50066a01 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/Internal/DeserializeManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/Internal/DeserializeManifestOperation.cs
@@ -74,7 +74,7 @@ namespace YooAsset
// 读取文件标记
uint fileSign = _buffer.ReadUInt32();
- if (fileSign != ManifestDefine.FileSign)
+ if (fileSign != PackageManifestDefine.FileSign)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
@@ -85,8 +85,8 @@ namespace YooAsset
// 读取文件版本
string fileVersion = _buffer.ReadUTF8();
Version fileVer = new Version(fileVersion);
- Version ver2025_8_28 = new Version(ManifestDefine.VERSION_2025_8_28);
- Version ver2025_9_30 = new Version(ManifestDefine.VERSION_2025_9_30);
+ Version ver2025_8_28 = new Version(PackageManifestDefine.VERSION_2025_8_28);
+ Version ver2025_9_30 = new Version(PackageManifestDefine.VERSION_2025_9_30);
if (fileVer < ver2025_8_28)
{
_steps = ESteps.Done;
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/Internal/InitializeFileSystemOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/Internal/InitializeFileSystemOperation.cs
index 90e139c7..ca7c2d96 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/Internal/InitializeFileSystemOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/Internal/InitializeFileSystemOperation.cs
@@ -14,15 +14,15 @@ namespace YooAsset
Done,
}
- private readonly PlayModeImpl _impl;
+ private readonly FileSystemHost _host;
private readonly List _parametersList;
private List _cloneList;
private FSInitializeFileSystemOperation _initFileSystemOp;
private ESteps _steps = ESteps.None;
- internal InitializeFileSystemOperation(PlayModeImpl impl, List parametersList)
+ internal InitializeFileSystemOperation(FileSystemHost host, List parametersList)
{
- _impl = impl;
+ _host = host;
_parametersList = parametersList;
}
internal override void InternalStart()
@@ -71,7 +71,7 @@ namespace YooAsset
var fileSystemParams = _cloneList[0];
_cloneList.RemoveAt(0);
- IFileSystem fileSystemInstance = fileSystemParams.CreateFileSystem(_impl.PackageName);
+ IFileSystem fileSystemInstance = fileSystemParams.CreateFileSystem(_host.PackageName);
if (fileSystemInstance == null)
{
_steps = ESteps.Done;
@@ -80,7 +80,7 @@ namespace YooAsset
return;
}
- _impl.FileSystems.Add(fileSystemInstance);
+ _host.FileSystems.Add(fileSystemInstance);
_initFileSystemOp = fileSystemInstance.InitializeFileSystemAsync();
_initFileSystemOp.StartOperation();
AddChildOperation(_initFileSystemOp);
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/LoadPackageManifestOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/LoadPackageManifestOperation.cs
index 43924e50..6394dfb5 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/LoadPackageManifestOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/LoadPackageManifestOperation.cs
@@ -12,14 +12,14 @@ namespace YooAsset
Done,
}
- private readonly PlayModeImpl _impl;
+ private readonly FileSystemHost _host;
private readonly LoadPackageManifestOptions _options;
private FSLoadPackageManifestOperation _loadPackageManifestOp;
private ESteps _steps = ESteps.None;
- internal LoadPackageManifestOperation(PlayModeImpl impl, LoadPackageManifestOptions options)
+ internal LoadPackageManifestOperation(FileSystemHost host, LoadPackageManifestOptions options)
{
- _impl = impl;
+ _host = host;
_options = options;
}
internal override void InternalStart()
@@ -48,7 +48,7 @@ namespace YooAsset
if (_steps == ESteps.CheckActiveManifest)
{
// 检测当前激活的清单对象
- if (_impl.ActiveManifest != null && _impl.ActiveManifest.PackageVersion == _options.PackageVersion)
+ if (_host.ActiveManifest != null && _host.ActiveManifest.PackageVersion == _options.PackageVersion)
{
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
@@ -63,7 +63,7 @@ namespace YooAsset
{
if (_loadPackageManifestOp == null)
{
- var mainFileSystem = _impl.GetMainFileSystem();
+ var mainFileSystem = _host.GetMainFileSystem();
_loadPackageManifestOp = mainFileSystem.LoadPackageManifestAsync(_options);
_loadPackageManifestOp.StartOperation();
AddChildOperation(_loadPackageManifestOp);
@@ -76,7 +76,7 @@ namespace YooAsset
if (_loadPackageManifestOp.Status == EOperationStatus.Succeed)
{
_steps = ESteps.Done;
- _impl.ActiveManifest = _loadPackageManifestOp.Manifest;
+ _host.ActiveManifest = _loadPackageManifestOp.Manifest;
Status = EOperationStatus.Succeed;
}
else
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
index d03b782c..ca661e77 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/PreDownloadContentOperation.cs
@@ -15,7 +15,7 @@ namespace YooAsset
Done,
}
- private readonly PlayModeImpl _impl;
+ private readonly FileSystemHost _host;
private readonly PreDownloadContentOptions _options;
private readonly int _timeout;
private FSLoadPackageManifestOperation _loadPackageManifestOp;
@@ -23,9 +23,9 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
- internal PreDownloadContentOperation(PlayModeImpl impl, PreDownloadContentOptions options)
+ internal PreDownloadContentOperation(FileSystemHost host, PreDownloadContentOptions options)
{
- _impl = impl;
+ _host = host;
_options = options;
}
internal override void InternalStart()
@@ -53,11 +53,11 @@ namespace YooAsset
if (_steps == ESteps.CheckActiveManifest)
{
// 检测当前激活的清单对象
- if (_impl.ActiveManifest != null)
+ if (_host.ActiveManifest != null)
{
- if (_impl.ActiveManifest.PackageVersion == _options.PackageVersion)
+ if (_host.ActiveManifest.PackageVersion == _options.PackageVersion)
{
- _manifest = _impl.ActiveManifest;
+ _manifest = _host.ActiveManifest;
_steps = ESteps.Done;
Status = EOperationStatus.Succeed;
return;
@@ -70,7 +70,7 @@ namespace YooAsset
{
if (_loadPackageManifestOp == null)
{
- var mainFileSystem = _impl.GetMainFileSystem();
+ var mainFileSystem = _host.GetMainFileSystem();
var options = new LoadPackageManifestOptions(_options.PackageVersion, _options.Timeout);
_loadPackageManifestOp = mainFileSystem.LoadPackageManifestAsync(options);
_loadPackageManifestOp.StartOperation();
@@ -106,11 +106,11 @@ namespace YooAsset
if (Status != EOperationStatus.Succeed)
{
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
- return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
+ return ResourceDownloaderOperation.CreateEmptyDownloader(_host.PackageName, downloadingMaxNumber, failedTryAgain);
}
- List downloadList = _impl.GetDownloadListByAll(_manifest);
- var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
+ List downloadList = _host.GetDownloadListByAll(_manifest);
+ var operation = new ResourceDownloaderOperation(_host.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
return operation;
}
@@ -125,11 +125,11 @@ namespace YooAsset
if (Status != EOperationStatus.Succeed)
{
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
- return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
+ return ResourceDownloaderOperation.CreateEmptyDownloader(_host.PackageName, downloadingMaxNumber, failedTryAgain);
}
- List downloadList = _impl.GetDownloadListByTags(_manifest, new string[] { tag });
- var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
+ List downloadList = _host.GetDownloadListByTags(_manifest, new string[] { tag });
+ var operation = new ResourceDownloaderOperation(_host.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
return operation;
}
@@ -144,11 +144,11 @@ namespace YooAsset
if (Status != EOperationStatus.Succeed)
{
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
- return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
+ return ResourceDownloaderOperation.CreateEmptyDownloader(_host.PackageName, downloadingMaxNumber, failedTryAgain);
}
- List downloadList = _impl.GetDownloadListByTags(_manifest, tags);
- var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
+ List downloadList = _host.GetDownloadListByTags(_manifest, tags);
+ var operation = new ResourceDownloaderOperation(_host.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
return operation;
}
@@ -163,15 +163,15 @@ namespace YooAsset
if (Status != EOperationStatus.Succeed)
{
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
- return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
+ return ResourceDownloaderOperation.CreateEmptyDownloader(_host.PackageName, downloadingMaxNumber, failedTryAgain);
}
List assetInfos = new List();
var assetInfo = _manifest.ConvertLocationToAssetInfo(location, null);
assetInfos.Add(assetInfo);
- List downloadList = _impl.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload);
- var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
+ List downloadList = _host.GetDownloadListByAssetInfos(_manifest, assetInfos.ToArray(), recursiveDownload);
+ var operation = new ResourceDownloaderOperation(_host.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
return operation;
}
@@ -186,7 +186,7 @@ namespace YooAsset
if (Status != EOperationStatus.Succeed)
{
YooLogger.Warning($"{nameof(PreDownloadContentOperation)} status is not succeed !");
- return ResourceDownloaderOperation.CreateEmptyDownloader(_impl.PackageName, downloadingMaxNumber, failedTryAgain);
+ return ResourceDownloaderOperation.CreateEmptyDownloader(_host.PackageName, downloadingMaxNumber, failedTryAgain);
}
List assetInfos = new List(locations.Length);
@@ -196,8 +196,8 @@ namespace YooAsset
assetInfos.Add(assetInfo);
}
- List downloadList = _impl.GetDownloadListByPaths(_manifest, assetInfos.ToArray(), recursiveDownload);
- var operation = new ResourceDownloaderOperation(_impl.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
+ List downloadList = _host.GetDownloadListByAssetInfos(_manifest, assetInfos.ToArray(), recursiveDownload);
+ var operation = new ResourceDownloaderOperation(_host.PackageName, downloadList, downloadingMaxNumber, failedTryAgain);
return operation;
}
}
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/Operation/RequestPackageVersionOperation.cs b/Assets/YooAsset/Runtime/ResourcePackage/Operation/RequestPackageVersionOperation.cs
index 3761a690..348e1e8a 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/Operation/RequestPackageVersionOperation.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/Operation/RequestPackageVersionOperation.cs
@@ -1,14 +1,7 @@
namespace YooAsset
{
- public abstract class RequestPackageVersionOperation : AsyncOperationBase
- {
- ///
- /// 当前最新的包裹版本
- ///
- public string PackageVersion { protected set; get; }
- }
- internal sealed class RequestPackageVersionImplOperation : RequestPackageVersionOperation
+ public sealed class RequestPackageVersionOperation : AsyncOperationBase
{
private enum ESteps
{
@@ -17,14 +10,20 @@ namespace YooAsset
Done,
}
- private readonly PlayModeImpl _impl;
+ private readonly FileSystemHost _host;
private readonly RequestPackageVersionOptions _options;
private FSRequestPackageVersionOperation _requestPackageVersionOp;
private ESteps _steps = ESteps.None;
- internal RequestPackageVersionImplOperation(PlayModeImpl impl, RequestPackageVersionOptions options)
+ ///
+ /// 当前最新的包裹版本
+ ///
+ public string PackageVersion { private set; get; }
+
+
+ internal RequestPackageVersionOperation(FileSystemHost host, RequestPackageVersionOptions options)
{
- _impl = impl;
+ _host = host;
_options = options;
}
internal override void InternalStart()
@@ -40,7 +39,7 @@ namespace YooAsset
{
if (_requestPackageVersionOp == null)
{
- var mainFileSystem = _impl.GetMainFileSystem();
+ var mainFileSystem = _host.GetMainFileSystem();
_requestPackageVersionOp = mainFileSystem.RequestPackageVersionAsync(_options);
_requestPackageVersionOp.StartOperation();
AddChildOperation(_requestPackageVersionOp);
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PackageBundle.cs b/Assets/YooAsset/Runtime/ResourcePackage/PackageBundle.cs
index a8ebeaeb..8749a540 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/PackageBundle.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PackageBundle.cs
@@ -122,8 +122,8 @@ namespace YooAsset
{
_mainfest = manifest;
_bundleType = manifest.BuildBundleType;
- _fileExtension = ManifestTools.GetRemoteBundleFileExtension(BundleName);
- _fileName = ManifestTools.GetRemoteBundleFileName(manifest.OutputNameStyle, BundleName, _fileExtension, FileHash);
+ _fileExtension = PackageManifestTools.GetRemoteBundleFileExtension(BundleName);
+ _fileName = PackageManifestTools.GetRemoteBundleFileName(manifest.OutputNameStyle, BundleName, _fileExtension, FileHash);
}
///
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs b/Assets/YooAsset/Runtime/ResourcePackage/PackageManifestDefine.cs
similarity index 94%
rename from Assets/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs
rename to Assets/YooAsset/Runtime/ResourcePackage/PackageManifestDefine.cs
index 91a9e93f..a45e9b6c 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PackageManifestDefine.cs
@@ -1,7 +1,7 @@
namespace YooAsset
{
- public class ManifestDefine
+ internal class PackageManifestDefine
{
///
/// 文件极限大小(100MB)
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs.meta b/Assets/YooAsset/Runtime/ResourcePackage/PackageManifestDefine.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs.meta
rename to Assets/YooAsset/Runtime/ResourcePackage/PackageManifestDefine.cs.meta
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/ManifestTools.cs b/Assets/YooAsset/Runtime/ResourcePackage/PackageManifestHelper.cs
similarity index 97%
rename from Assets/YooAsset/Runtime/ResourcePackage/ManifestTools.cs
rename to Assets/YooAsset/Runtime/ResourcePackage/PackageManifestHelper.cs
index f27792e8..46a19258 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/ManifestTools.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/PackageManifestHelper.cs
@@ -6,7 +6,7 @@ using UnityEngine;
namespace YooAsset
{
- internal static class ManifestTools
+ internal static class PackageManifestTools
{
///
/// 验证清单文件的二进制数据
@@ -49,10 +49,10 @@ namespace YooAsset
using (FileStream fs = new FileStream(savePath, FileMode.Create))
{
// 创建缓存器
- BufferWriter buffer = new BufferWriter(ManifestDefine.FileMaxSize);
+ BufferWriter buffer = new BufferWriter(PackageManifestDefine.FileMaxSize);
// 写入文件标记
- buffer.WriteUInt32(ManifestDefine.FileSign);
+ buffer.WriteUInt32(PackageManifestDefine.FileSign);
// 写入文件版本
buffer.WriteUTF8(manifest.FileVersion);
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/ManifestTools.cs.meta b/Assets/YooAsset/Runtime/ResourcePackage/PackageManifestHelper.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/ResourcePackage/ManifestTools.cs.meta
rename to Assets/YooAsset/Runtime/ResourcePackage/PackageManifestHelper.cs.meta
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode.meta b/Assets/YooAsset/Runtime/ResourcePackage/PlayMode.meta
deleted file mode 100644
index 64d721b3..00000000
--- a/Assets/YooAsset/Runtime/ResourcePackage/PlayMode.meta
+++ /dev/null
@@ -1,8 +0,0 @@
-fileFormatVersion: 2
-guid: e9d6cb1ce5d510645866ad7c122abfab
-folderAsset: yes
-DefaultImporter:
- externalObjects: {}
- userData:
- assetBundleName:
- assetBundleVariant:
diff --git a/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs b/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
index 94a0355c..245bcd29 100644
--- a/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
+++ b/Assets/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
@@ -10,8 +10,7 @@ namespace YooAsset
{
private InitializePackageOperation _initializeOp;
internal ResourceManager _resourceManager;
- internal IBundleQuery _bundleQuery;
- internal IPlayMode _playModeImpl;
+ internal FileSystemHost _fileSystemHost;
internal EPlayMode _playMode;
///
@@ -39,9 +38,9 @@ namespace YooAsset
{
get
{
- if (_playModeImpl == null)
+ if (_fileSystemHost == null)
return false;
- return _playModeImpl.ActiveManifest != null;
+ return _fileSystemHost.ActiveManifest != null;
}
}
@@ -66,7 +65,6 @@ namespace YooAsset
internal void InternalDestroy()
{
_initializeOp = null;
- _bundleQuery = null;
// 销毁资源管理器
if (_resourceManager != null)
@@ -75,11 +73,11 @@ namespace YooAsset
_resourceManager = null;
}
- // 销毁文件系统
- if (_playModeImpl != null)
+ // 销毁文件系统中枢
+ if (_fileSystemHost != null)
{
- _playModeImpl.DestroyFileSystem();
- _playModeImpl = null;
+ _fileSystemHost.Destroy();
+ _fileSystemHost = null;
}
}
@@ -135,7 +133,7 @@ namespace YooAsset
public RequestPackageVersionOperation RequestPackageVersionAsync(RequestPackageVersionOptions options)
{
DebugCheckInitialize(false);
- var operation = _playModeImpl.RequestPackageVersionAsync(options);
+ var operation = new RequestPackageVersionOperation(_fileSystemHost, options);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
@@ -153,7 +151,7 @@ namespace YooAsset
YooLogger.Warning($"Found loaded bundle before update manifest ! Recommended to call the {nameof(UnloadAllAssetsAsync)} method to release loaded bundle !");
}
- var operation = _playModeImpl.LoadPackageManifestAsync(options);
+ var operation = new LoadPackageManifestOperation(_fileSystemHost, options);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
@@ -164,7 +162,7 @@ namespace YooAsset
public PreDownloadContentOperation PreDownloadContentAsync(PreDownloadContentOptions options)
{
DebugCheckInitialize(false);
- var operation = _playModeImpl.PreDownloadContentAsync(options);
+ var operation = new PreDownloadContentOperation(_fileSystemHost, options);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
@@ -175,7 +173,8 @@ namespace YooAsset
public ClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options)
{
DebugCheckInitialize(false);
- var operation = _playModeImpl.ClearCacheFilesAsync(options);
+ options.Manifest = _fileSystemHost.ActiveManifest;
+ var operation = new ClearCacheFilesOperation(_fileSystemHost, options);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
@@ -188,7 +187,7 @@ namespace YooAsset
public string GetPackageVersion()
{
DebugCheckInitialize();
- return _playModeImpl.ActiveManifest.PackageVersion;
+ return _fileSystemHost.ActiveManifest.PackageVersion;
}
///
@@ -197,7 +196,7 @@ namespace YooAsset
public string GetPackageNote()
{
DebugCheckInitialize();
- return _playModeImpl.ActiveManifest.PackageNote;
+ return _fileSystemHost.ActiveManifest.PackageNote;
}
///
@@ -206,7 +205,7 @@ namespace YooAsset
public PackageDetails GetPackageDetails()
{
DebugCheckInitialize();
- return _playModeImpl.ActiveManifest.GetPackageDetails();
+ return _fileSystemHost.ActiveManifest.GetPackageDetails();
}
#endregion
@@ -216,7 +215,7 @@ namespace YooAsset
///
public UnloadAllAssetsOperation UnloadAllAssetsAsync()
{
- var options = new UnloadAllAssetsOptions();
+ var options = new UnloadAllAssetsOptions(true, true);
return UnloadAllAssetsAsync(options);
}
@@ -235,12 +234,22 @@ namespace YooAsset
///
/// 回收不再使用的资源
/// 说明:卸载引用计数为零的资源
+ /// 说明:默认循环10次
///
- /// 循环迭代次数
- public UnloadUnusedAssetsOperation UnloadUnusedAssetsAsync(int loopCount = 10)
+ public UnloadUnusedAssetsOperation UnloadUnusedAssetsAsync()
+ {
+ var options = new UnloadUnusedAssetsOptions(10);
+ return UnloadUnusedAssetsAsync(options);
+ }
+
+ ///
+ /// 回收不再使用的资源
+ /// 说明:卸载引用计数为零的资源
+ ///
+ public UnloadUnusedAssetsOperation UnloadUnusedAssetsAsync(UnloadUnusedAssetsOptions options)
{
DebugCheckInitialize();
- var operation = new UnloadUnusedAssetsOperation(_resourceManager, loopCount);
+ var operation = new UnloadUnusedAssetsOperation(_resourceManager, options);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
@@ -295,7 +304,7 @@ namespace YooAsset
public AssetInfo[] GetAllAssetInfos()
{
DebugCheckInitialize();
- return _playModeImpl.ActiveManifest.GetAllAssetInfos();
+ return _fileSystemHost.ActiveManifest.GetAllAssetInfos();
}
///
@@ -306,7 +315,7 @@ namespace YooAsset
{
DebugCheckInitialize();
string[] tags = new string[] { tag };
- return _playModeImpl.ActiveManifest.GetAssetInfosByTags(tags);
+ return _fileSystemHost.ActiveManifest.GetAssetInfosByTags(tags);
}
///
@@ -316,7 +325,7 @@ namespace YooAsset
public AssetInfo[] GetAssetInfos(string[] tags)
{
DebugCheckInitialize();
- return _playModeImpl.ActiveManifest.GetAssetInfosByTags(tags);
+ return _fileSystemHost.ActiveManifest.GetAssetInfosByTags(tags);
}
///
@@ -368,7 +377,7 @@ namespace YooAsset
public bool CheckLocationValid(string location)
{
DebugCheckInitialize();
- string assetPath = _playModeImpl.ActiveManifest.TryMappingToAssetPath(location);
+ string assetPath = _fileSystemHost.ActiveManifest.TryMappingToAssetPath(location);
return string.IsNullOrEmpty(assetPath) == false;
}
@@ -380,11 +389,11 @@ namespace YooAsset
return false;
}
- BundleInfo bundleInfo = _bundleQuery.GetMainBundleInfo(assetInfo);
+ BundleInfo bundleInfo = _fileSystemHost.GetMainBundleInfo(assetInfo);
if (bundleInfo.IsNeedDownloadFromRemote())
return true;
- List depends = _bundleQuery.GetDependBundleInfos(assetInfo);
+ List depends = _fileSystemHost.GetDependBundleInfos(assetInfo);
foreach (var depend in depends)
{
if (depend.IsNeedDownloadFromRemote())
@@ -849,192 +858,55 @@ namespace YooAsset
#endregion
#region 资源下载
- ///
- /// 创建资源下载器,用于下载当前资源版本所有的资源包文件
- ///
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckInitialize();
- return _playModeImpl.CreateResourceDownloaderByAll(downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源标签关联的资源包文件
- ///
- /// 资源标签
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckInitialize();
- return _playModeImpl.CreateResourceDownloaderByTags(new string[] { tag }, downloadingMaxNumber, failedTryAgain);
- }
-
///
/// 创建资源下载器,用于下载指定的资源标签列表关联的资源包文件
///
- /// 资源标签列表
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain)
+ public ResourceDownloaderOperation CreateResourceDownloader(ResourceDownloaderOptions options)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceDownloaderByTags(tags, downloadingMaxNumber, failedTryAgain);
+ return _fileSystemHost.CreateResourceDownloader(options);
}
///
- /// 创建资源下载器,用于下载指定的资源依赖的资源包文件
+ /// 创建资源下载器,用于下载指定的资源信息列表依赖的资源包文件
///
- /// 资源的定位地址
- /// 下载资源对象所属资源包内所有资源对象依赖的资源包
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public ResourceDownloaderOperation CreateBundleDownloader(string location, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain)
+ public ResourceDownloaderOperation CreateBundleDownloader(BundleDownloaderOptions options)
{
DebugCheckInitialize();
- var assetInfo = ConvertLocationToAssetInfo(location, null);
- AssetInfo[] assetInfos = new AssetInfo[] { assetInfo };
- return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain);
- }
- public ResourceDownloaderOperation CreateBundleDownloader(string location, int downloadingMaxNumber, int failedTryAgain)
- {
- return CreateBundleDownloader(location, false, downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源列表依赖的资源包文件
- ///
- /// 资源的定位地址列表
- /// 下载资源对象所属资源包内所有资源对象依赖的资源包
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public ResourceDownloaderOperation CreateBundleDownloader(string[] locations, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckInitialize();
- List assetInfos = new List(locations.Length);
- foreach (var location in locations)
- {
- var assetInfo = ConvertLocationToAssetInfo(location, null);
- assetInfos.Add(assetInfo);
- }
- return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos.ToArray(), recursiveDownload, downloadingMaxNumber, failedTryAgain);
- }
- public ResourceDownloaderOperation CreateBundleDownloader(string[] locations, int downloadingMaxNumber, int failedTryAgain)
- {
- return CreateBundleDownloader(locations, false, downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源依赖的资源包文件
- ///
- /// 资源信息
- /// 下载资源对象所属资源包内所有资源对象依赖的资源包
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo assetInfo, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckInitialize();
- AssetInfo[] assetInfos = new AssetInfo[] { assetInfo };
- return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain);
- }
- public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo assetInfo, int downloadingMaxNumber, int failedTryAgain)
- {
- return CreateBundleDownloader(assetInfo, false, downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源列表依赖的资源包文件
- ///
- /// 资源信息列表
- /// 下载资源对象所属资源包内所有资源对象依赖的资源包
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, bool recursiveDownload, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckInitialize();
- return _playModeImpl.CreateResourceDownloaderByPaths(assetInfos, recursiveDownload, downloadingMaxNumber, failedTryAgain);
- }
- public ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain)
- {
- return CreateBundleDownloader(assetInfos, false, downloadingMaxNumber, failedTryAgain);
+ return _fileSystemHost.CreateResourceDownloader(options);
}
#endregion
#region 资源解压
- ///
- /// 创建内置资源解压器,用于解压当前资源版本所有的资源包文件
- ///
- /// 同时解压的最大文件数
- /// 解压失败的重试次数
- public ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
- {
- DebugCheckInitialize();
- return _playModeImpl.CreateResourceUnpackerByAll(unpackingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建内置资源解压器,用于解压指定的资源标签关联的资源包文件
- ///
- /// 资源标签
- /// 同时解压的最大文件数
- /// 解压失败的重试次数
- public ResourceUnpackerOperation CreateResourceUnpacker(string tag, int unpackingMaxNumber, int failedTryAgain)
- {
- DebugCheckInitialize();
- return _playModeImpl.CreateResourceUnpackerByTags(new string[] { tag }, unpackingMaxNumber, failedTryAgain);
- }
-
///
/// 创建内置资源解压器,用于解压指定的资源标签列表关联的资源包文件
///
- /// 资源标签列表
- /// 同时解压的最大文件数
- /// 解压失败的重试次数
- public ResourceUnpackerOperation CreateResourceUnpacker(string[] tags, int unpackingMaxNumber, int failedTryAgain)
+ public ResourceUnpackerOperation CreateResourceUnpacker(ResourceUnpackerOptions options)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceUnpackerByTags(tags, unpackingMaxNumber, failedTryAgain);
+ return _fileSystemHost.CreateResourceUnpacker(options);
}
#endregion
#region 资源导入
///
/// 创建资源导入器
- /// 注意:资源文件名称必须和资源服务器部署的文件名称一致!
///
- /// 资源路径列表
- /// 同时导入的最大文件数
- /// 导入失败的重试次数
- public ResourceImporterOperation CreateResourceImporter(string[] filePaths, int importerMaxNumber, int failedTryAgain)
+ public ResourceImporterOperation CreateResourceImporter(BundleImporterOptions options)
{
DebugCheckInitialize();
- return _playModeImpl.CreateResourceImporterByFilePaths(filePaths, importerMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源导入器
- /// 注意:资源信息里需要指定BundleName或BundleGUID!
- ///
- /// 资源信息列表
- /// 同时导入的最大文件数
- /// 导入失败的重试次数
- public ResourceImporterOperation CreateResourceImporter(ImportFileInfo[] fileInfos, int importerMaxNumber, int failedTryAgain)
- {
- DebugCheckInitialize();
- return _playModeImpl.CreateResourceImporterByFileInfos(fileInfos, importerMaxNumber, failedTryAgain);
+ return _fileSystemHost.CreateResourceImporter(options);
}
#endregion
#region 内部方法
- private AssetInfo ConvertLocationToAssetInfo(string location, System.Type assetType)
+ internal AssetInfo ConvertLocationToAssetInfo(string location, System.Type assetType)
{
- return _playModeImpl.ActiveManifest.ConvertLocationToAssetInfo(location, assetType);
+ return _fileSystemHost.ActiveManifest.ConvertLocationToAssetInfo(location, assetType);
}
- private AssetInfo ConvertAssetGUIDToAssetInfo(string assetGUID, System.Type assetType)
+ internal AssetInfo ConvertAssetGUIDToAssetInfo(string assetGUID, System.Type assetType)
{
- return _playModeImpl.ActiveManifest.ConvertAssetGUIDToAssetInfo(assetGUID, assetType);
+ return _fileSystemHost.ActiveManifest.ConvertAssetGUIDToAssetInfo(assetGUID, assetType);
}
#endregion
@@ -1060,7 +932,7 @@ namespace YooAsset
if (checkActiveManifest)
{
- if (_playModeImpl.ActiveManifest == null)
+ if (_fileSystemHost.ActiveManifest == null)
throw new YooPackageException(PackageName, "Can not found active package manifest !");
}
}
diff --git a/Assets/YooAsset/Runtime/Services/IDecryptionServices.cs b/Assets/YooAsset/Runtime/Services/IBundleDecryptionServices.cs
similarity index 52%
rename from Assets/YooAsset/Runtime/Services/IDecryptionServices.cs
rename to Assets/YooAsset/Runtime/Services/IBundleDecryptionServices.cs
index a5587dc3..257fb2e4 100644
--- a/Assets/YooAsset/Runtime/Services/IDecryptionServices.cs
+++ b/Assets/YooAsset/Runtime/Services/IBundleDecryptionServices.cs
@@ -3,7 +3,7 @@ using UnityEngine;
namespace YooAsset
{
- public struct DecryptFileInfo
+ public struct DecryptBundleInfo
{
///
/// 资源包名称
@@ -20,13 +20,8 @@ namespace YooAsset
///
public uint FileLoadCRC;
}
- public struct DecryptResult
+ public struct DecryptAsyncResult
{
- ///
- /// 资源包对象
- ///
- public AssetBundle Result;
-
///
/// 异步请求句柄
///
@@ -38,18 +33,30 @@ namespace YooAsset
///
public Stream ManagedStream;
}
+ public struct DecryptSyncResult
+ {
+ ///
+ /// 资源包对象
+ ///
+ public AssetBundle Result;
- public interface IDecryptionServices
+ ///
+ /// 托管流对象
+ /// 注意:流对象在资源包对象释放的时候会自动释放
+ ///
+ public Stream ManagedStream;
+ }
+ public interface IBundleDecryptionServices
{
///
/// 同步方式获取解密的资源包
///
- DecryptResult LoadAssetBundle(DecryptFileInfo fileInfo);
+ DecryptSyncResult LoadAssetBundleSync(DecryptBundleInfo bundleInfo);
///
/// 异步方式获取解密的资源包
///
- DecryptResult LoadAssetBundleAsync(DecryptFileInfo fileInfo);
+ DecryptAsyncResult LoadAssetBundleAsync(DecryptBundleInfo bundleInfo);
///
/// 后备方式获取解密的资源包
@@ -57,16 +64,45 @@ namespace YooAsset
/// 说明:建议通过LoadFromMemory()方法加载资源包作为保底机制。
/// issues : https://github.com/tuyoogame/YooAsset/issues/562
///
- DecryptResult LoadAssetBundleFallback(DecryptFileInfo fileInfo);
+ DecryptSyncResult LoadAssetBundleFallback(DecryptBundleInfo bundleInfo);
///
/// 获取解密的字节数据
///
- byte[] ReadFileData(DecryptFileInfo fileInfo);
+ byte[] ReadFileData(DecryptBundleInfo bundleInfo);
///
/// 获取解密的文本数据
///
- string ReadFileText(DecryptFileInfo fileInfo);
+ string ReadFileText(DecryptBundleInfo bundleInfo);
+ }
+
+ public struct WebDecryptBundleInfo
+ {
+ ///
+ /// 资源包名称
+ ///
+ public string BundleName;
+
+ ///
+ /// Unity引擎用于内容校验的CRC
+ ///
+ public uint FileLoadCRC;
+
+ ///
+ /// 文件字节数据
+ ///
+ public byte[] FileData;
+ }
+ public struct WebDecryptSyncResult
+ {
+ ///
+ /// 资源包对象
+ ///
+ public AssetBundle Result;
+ }
+ public interface IWebBundleDecryptionServices
+ {
+ WebDecryptSyncResult LoadAssetBundleSync(WebDecryptBundleInfo bundleInfo);
}
}
diff --git a/Assets/YooAsset/Runtime/Services/IDecryptionServices.cs.meta b/Assets/YooAsset/Runtime/Services/IBundleDecryptionServices.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/Services/IDecryptionServices.cs.meta
rename to Assets/YooAsset/Runtime/Services/IBundleDecryptionServices.cs.meta
diff --git a/Assets/YooAsset/Runtime/Services/IEncryptionServices.cs b/Assets/YooAsset/Runtime/Services/IBundleEncryptionServices.cs
similarity index 78%
rename from Assets/YooAsset/Runtime/Services/IEncryptionServices.cs
rename to Assets/YooAsset/Runtime/Services/IBundleEncryptionServices.cs
index 6facc4dd..7846e28e 100644
--- a/Assets/YooAsset/Runtime/Services/IEncryptionServices.cs
+++ b/Assets/YooAsset/Runtime/Services/IBundleEncryptionServices.cs
@@ -1,7 +1,7 @@
namespace YooAsset
{
- public struct EncryptFileInfo
+ public struct EncryptBundleInfo
{
///
/// 资源包名称
@@ -25,9 +25,8 @@ namespace YooAsset
///
public byte[] EncryptedData;
}
-
- public interface IEncryptionServices
+ public interface IBundleEncryptionServices
{
- EncryptResult Encrypt(EncryptFileInfo fileInfo);
+ EncryptResult Encrypt(EncryptBundleInfo bundleInfo);
}
}
\ No newline at end of file
diff --git a/Assets/YooAsset/Runtime/Services/IEncryptionServices.cs.meta b/Assets/YooAsset/Runtime/Services/IBundleEncryptionServices.cs.meta
similarity index 100%
rename from Assets/YooAsset/Runtime/Services/IEncryptionServices.cs.meta
rename to Assets/YooAsset/Runtime/Services/IBundleEncryptionServices.cs.meta
diff --git a/Assets/YooAsset/Runtime/Services/IWebDecryptionServices.cs b/Assets/YooAsset/Runtime/Services/IWebDecryptionServices.cs
deleted file mode 100644
index 99e7cd63..00000000
Binary files a/Assets/YooAsset/Runtime/Services/IWebDecryptionServices.cs and /dev/null differ
diff --git a/Assets/YooAsset/Runtime/YooAssets.cs b/Assets/YooAsset/Runtime/YooAssets.cs
index e17c1b3f..2d2754c5 100644
--- a/Assets/YooAsset/Runtime/YooAssets.cs
+++ b/Assets/YooAsset/Runtime/YooAssets.cs
@@ -15,7 +15,6 @@ namespace YooAsset
{
_isInitialize = false;
_packages.Clear();
- _defaultPackage = null;
}
#endif
diff --git a/Assets/YooAsset/Runtime/YooAssetsExtension.cs b/Assets/YooAsset/Runtime/YooAssetsExtension.cs
deleted file mode 100644
index 504bc429..00000000
--- a/Assets/YooAsset/Runtime/YooAssetsExtension.cs
+++ /dev/null
@@ -1,619 +0,0 @@
-using System;
-using System.Diagnostics;
-using System.Collections;
-using System.Collections.Generic;
-using UnityEngine.SceneManagement;
-
-namespace YooAsset
-{
- public static partial class YooAssets
- {
- private static ResourcePackage _defaultPackage;
-
- ///
- /// 设置默认的资源包
- ///
- public static void SetDefaultPackage(ResourcePackage package)
- {
- _defaultPackage = package;
- }
-
- #region 资源信息
- ///
- /// 是否需要从远端更新下载
- ///
- /// 资源的定位地址
- public static bool IsNeedDownloadFromRemote(string location)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.IsNeedDownloadFromRemote(location);
- }
-
- ///
- /// 是否需要从远端更新下载
- ///
- /// 资源的定位地址
- public static bool IsNeedDownloadFromRemote(AssetInfo assetInfo)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.IsNeedDownloadFromRemote(assetInfo);
- }
-
- ///
- /// 获取资源信息列表
- ///
- /// 资源标签
- public static AssetInfo[] GetAssetInfos(string tag)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.GetAssetInfos(tag);
- }
-
- ///
- /// 获取资源信息列表
- ///
- /// 资源标签列表
- public static AssetInfo[] GetAssetInfos(string[] tags)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.GetAssetInfos(tags);
- }
-
- ///
- /// 获取资源信息
- ///
- /// 资源的定位地址
- public static AssetInfo GetAssetInfo(string location)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.GetAssetInfo(location);
- }
-
- ///
- /// 获取资源信息
- ///
- /// 资源的定位地址
- /// 资源类型
- public static AssetInfo GetAssetInfo(string location, System.Type type)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.GetAssetInfo(location, type);
- }
-
- ///
- /// 获取资源信息
- ///
- /// 资源GUID
- public static AssetInfo GetAssetInfoByGUID(string assetGUID)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.GetAssetInfoByGUID(assetGUID);
- }
-
- ///
- /// 获取资源信息
- ///
- /// 资源GUID
- /// 资源类型
- public static AssetInfo GetAssetInfoByGUID(string assetGUID, System.Type type)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.GetAssetInfoByGUID(assetGUID, type);
- }
-
- ///
- /// 检查资源定位地址是否有效
- ///
- /// 资源的定位地址
- public static bool CheckLocationValid(string location)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CheckLocationValid(location);
- }
- #endregion
-
- #region 原生文件
- ///
- /// 同步加载原生文件
- ///
- /// 资源信息
- public static RawFileHandle LoadRawFileSync(AssetInfo assetInfo)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadRawFileSync(assetInfo);
- }
-
- ///
- /// 同步加载原生文件
- ///
- /// 资源的定位地址
- public static RawFileHandle LoadRawFileSync(string location)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadRawFileSync(location);
- }
-
-
- ///
- /// 异步加载原生文件
- ///
- /// 资源信息
- public static RawFileHandle LoadRawFileAsync(AssetInfo assetInfo, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadRawFileAsync(assetInfo, priority);
- }
-
- ///
- /// 异步加载原生文件
- ///
- /// 资源的定位地址
- public static RawFileHandle LoadRawFileAsync(string location, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadRawFileAsync(location, priority);
- }
- #endregion
-
- #region 场景加载
- ///
- /// 同步加载场景
- ///
- /// 场景的定位地址
- /// 场景加载模式
- /// 场景物理模式
- public static SceneHandle LoadSceneSync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSceneSync(location, sceneMode, physicsMode);
- }
-
- ///
- /// 同步加载场景
- ///
- /// 场景的资源信息
- /// 场景加载模式
- /// 场景物理模式
- public static SceneHandle LoadSceneSync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSceneSync(assetInfo, sceneMode, physicsMode);
- }
-
- ///
- /// 异步加载场景
- ///
- /// 场景的定位地址
- /// 场景加载模式
- /// 场景物理模式
- /// 场景加载到90%自动挂起
- /// 优先级
- public static SceneHandle LoadSceneAsync(string location, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None, bool suspendLoad = false, uint priority = 100)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSceneAsync(location, sceneMode, physicsMode, suspendLoad, priority);
- }
-
- ///
- /// 异步加载场景
- ///
- /// 场景的资源信息
- /// 场景加载模式
- /// 场景物理模式
- /// 场景加载到90%自动挂起
- /// 优先级
- public static SceneHandle LoadSceneAsync(AssetInfo assetInfo, LoadSceneMode sceneMode = LoadSceneMode.Single, LocalPhysicsMode physicsMode = LocalPhysicsMode.None, bool suspendLoad = false, uint priority = 100)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSceneAsync(assetInfo, sceneMode, physicsMode, suspendLoad, priority);
- }
- #endregion
-
- #region 资源加载
- ///
- /// 同步加载资源对象
- ///
- /// 资源信息
- public static AssetHandle LoadAssetSync(AssetInfo assetInfo)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAssetSync(assetInfo);
- }
-
- ///
- /// 同步加载资源对象
- ///
- /// 资源类型
- /// 资源的定位地址
- public static AssetHandle LoadAssetSync(string location) where TObject : UnityEngine.Object
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAssetSync(location);
- }
-
- ///
- /// 同步加载资源对象
- ///
- /// 资源的定位地址
- /// 资源类型
- public static AssetHandle LoadAssetSync(string location, System.Type type)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAssetSync(location, type);
- }
-
- ///
- /// 同步加载资源对象
- ///
- /// 资源的定位地址
- public static AssetHandle LoadAssetSync(string location)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAssetSync(location);
- }
-
-
- ///
- /// 异步加载资源对象
- ///
- /// 资源信息
- public static AssetHandle LoadAssetAsync(AssetInfo assetInfo, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAssetAsync(assetInfo, priority);
- }
-
- ///
- /// 异步加载资源对象
- ///
- /// 资源类型
- /// 资源的定位地址
- public static AssetHandle LoadAssetAsync(string location, uint priority = 0) where TObject : UnityEngine.Object
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAssetAsync(location, priority);
- }
-
- ///
- /// 异步加载资源对象
- ///
- /// 资源的定位地址
- /// 资源类型
- public static AssetHandle LoadAssetAsync(string location, System.Type type, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAssetAsync(location, type, priority);
- }
-
- ///
- /// 异步加载资源对象
- ///
- /// 资源的定位地址
- public static AssetHandle LoadAssetAsync(string location, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAssetAsync(location, priority);
- }
- #endregion
-
- #region 资源加载
- ///
- /// 同步加载子资源对象
- ///
- /// 资源信息
- public static SubAssetsHandle LoadSubAssetsSync(AssetInfo assetInfo)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSubAssetsSync(assetInfo);
- }
-
- ///
- /// 同步加载子资源对象
- ///
- /// 资源类型
- /// 资源的定位地址
- public static SubAssetsHandle LoadSubAssetsSync(string location) where TObject : UnityEngine.Object
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSubAssetsSync(location);
- }
-
- ///
- /// 同步加载子资源对象
- ///
- /// 资源的定位地址
- /// 子对象类型
- public static SubAssetsHandle LoadSubAssetsSync(string location, System.Type type)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSubAssetsSync(location, type);
- }
-
- ///
- /// 同步加载子资源对象
- ///
- /// 资源的定位地址
- public static SubAssetsHandle LoadSubAssetsSync(string location)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSubAssetsSync(location);
- }
-
-
- ///
- /// 异步加载子资源对象
- ///
- /// 资源信息
- public static SubAssetsHandle LoadSubAssetsAsync(AssetInfo assetInfo, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSubAssetsAsync(assetInfo, priority);
- }
-
- ///
- /// 异步加载子资源对象
- ///
- /// 资源类型
- /// 资源的定位地址
- public static SubAssetsHandle LoadSubAssetsAsync(string location, uint priority = 0) where TObject : UnityEngine.Object
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSubAssetsAsync(location, priority);
- }
-
- ///
- /// 异步加载子资源对象
- ///
- /// 资源的定位地址
- /// 子对象类型
- public static SubAssetsHandle LoadSubAssetsAsync(string location, System.Type type, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSubAssetsAsync(location, type, priority);
- }
-
- ///
- /// 异步加载子资源对象
- ///
- /// 资源的定位地址
- public static SubAssetsHandle LoadSubAssetsAsync(string location, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadSubAssetsAsync(location, priority);
- }
- #endregion
-
- #region 资源加载
- ///
- /// 同步加载资源包内所有资源对象
- ///
- /// 资源信息
- public static AllAssetsHandle LoadAllAssetsSync(AssetInfo assetInfo)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAllAssetsSync(assetInfo);
- }
-
- ///
- /// 同步加载资源包内所有资源对象
- ///
- /// 资源类型
- /// 资源的定位地址
- public static AllAssetsHandle LoadAllAssetsSync(string location) where TObject : UnityEngine.Object
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAllAssetsSync(location);
- }
-
- ///
- /// 同步加载资源包内所有资源对象
- ///
- /// 资源的定位地址
- /// 子对象类型
- public static AllAssetsHandle LoadAllAssetsSync(string location, System.Type type)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAllAssetsSync(location, type);
- }
-
- ///
- /// 同步加载资源包内所有资源对象
- ///
- /// 资源的定位地址
- public static AllAssetsHandle LoadAllAssetsSync(string location)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAllAssetsSync(location);
- }
-
-
- ///
- /// 异步加载资源包内所有资源对象
- ///
- /// 资源信息
- public static AllAssetsHandle LoadAllAssetsAsync(AssetInfo assetInfo, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAllAssetsAsync(assetInfo, priority);
- }
-
- ///
- /// 异步加载资源包内所有资源对象
- ///
- /// 资源类型
- /// 资源的定位地址
- public static AllAssetsHandle LoadAllAssetsAsync(string location, uint priority = 0) where TObject : UnityEngine.Object
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAllAssetsAsync(location, priority);
- }
-
- ///
- /// 异步加载资源包内所有资源对象
- ///
- /// 资源的定位地址
- /// 子对象类型
- public static AllAssetsHandle LoadAllAssetsAsync(string location, System.Type type, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAllAssetsAsync(location, type, priority);
- }
-
- ///
- /// 异步加载资源包内所有资源对象
- ///
- /// 资源的定位地址
- public static AllAssetsHandle LoadAllAssetsAsync(string location, uint priority = 0)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.LoadAllAssetsAsync(location, priority);
- }
- #endregion
-
- #region 资源下载
- ///
- /// 创建资源下载器,用于下载当前资源版本所有的资源包文件
- ///
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public static ResourceDownloaderOperation CreateResourceDownloader(int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateResourceDownloader(downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源标签关联的资源包文件
- ///
- /// 资源标签
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public static ResourceDownloaderOperation CreateResourceDownloader(string tag, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateResourceDownloader(new string[] { tag }, downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源标签列表关联的资源包文件
- ///
- /// 资源标签列表
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public static ResourceDownloaderOperation CreateResourceDownloader(string[] tags, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateResourceDownloader(tags, downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源依赖的资源包文件
- ///
- /// 资源定位地址
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public static ResourceDownloaderOperation CreateBundleDownloader(string location, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateBundleDownloader(location, downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源列表依赖的资源包文件
- ///
- /// 资源定位地址列表
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public static ResourceDownloaderOperation CreateBundleDownloader(string[] locations, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateBundleDownloader(locations, downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源依赖的资源包文件
- ///
- /// 资源信息
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public static ResourceDownloaderOperation CreateBundleDownloader(AssetInfo assetInfo, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateBundleDownloader(assetInfo, downloadingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建资源下载器,用于下载指定的资源列表依赖的资源包文件
- ///
- /// 资源信息列表
- /// 同时下载的最大文件数
- /// 下载失败的重试次数
- public static ResourceDownloaderOperation CreateBundleDownloader(AssetInfo[] assetInfos, int downloadingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateBundleDownloader(assetInfos, downloadingMaxNumber, failedTryAgain);
- }
- #endregion
-
- #region 资源解压
- ///
- /// 创建内置资源解压器,用于解压当前资源版本所有的资源包文件
- ///
- /// 同时解压的最大文件数
- /// 解压失败的重试次数
- public static ResourceUnpackerOperation CreateResourceUnpacker(int unpackingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateResourceUnpacker(unpackingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建内置资源解压器,用于解压指定的资源标签关联的资源包文件
- ///
- /// 资源标签
- /// 同时解压的最大文件数
- /// 解压失败的重试次数
- public static ResourceUnpackerOperation CreateResourceUnpacker(string tag, int unpackingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateResourceUnpacker(tag, unpackingMaxNumber, failedTryAgain);
- }
-
- ///
- /// 创建内置资源解压器,用于解压指定的资源标签列表关联的资源包文件
- ///
- /// 资源标签列表
- /// 同时解压的最大文件数
- /// 解压失败的重试次数
- public static ResourceUnpackerOperation CreateResourceUnpacker(string[] tags, int unpackingMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateResourceUnpacker(tags, unpackingMaxNumber, failedTryAgain);
- }
- #endregion
-
- #region 资源导入
- ///
- /// 创建资源导入器
- /// 注意:资源文件名称必须和资源服务器部署的文件名称一致!
- ///
- /// 资源路径列表
- /// 同时导入的最大文件数
- /// 导入失败的重试次数
- public static ResourceImporterOperation CreateResourceImporter(string[] filePaths, int importerMaxNumber, int failedTryAgain)
- {
- DebugCheckDefaultPackageValid();
- return _defaultPackage.CreateResourceImporter(filePaths, importerMaxNumber, failedTryAgain);
- }
- #endregion
-
- #region 调试方法
- [Conditional("DEBUG")]
- private static void DebugCheckDefaultPackageValid()
- {
- if (_defaultPackage == null)
- throw new YooInitializeException($"Default package is null. Please use {nameof(YooAssets.SetDefaultPackage)} !");
- }
- #endregion
- }
-}
\ No newline at end of file
diff --git a/Assets/YooAsset/Samples~/Test Sample/Runtime/T2_TestBuldinFileSystem/T2_TestBuldinFileSystem.cs b/Assets/YooAsset/Samples~/Test Sample/Runtime/T2_TestBuldinFileSystem/T2_TestBuldinFileSystem.cs
index a44eff91..b63d88e0 100644
--- a/Assets/YooAsset/Samples~/Test Sample/Runtime/T2_TestBuldinFileSystem/T2_TestBuldinFileSystem.cs
+++ b/Assets/YooAsset/Samples~/Test Sample/Runtime/T2_TestBuldinFileSystem/T2_TestBuldinFileSystem.cs
@@ -64,7 +64,7 @@ public class T2_TestBuldinFileSystem : IPrebuildSetup, IPostBuildCleanup
var manifestServices = new TestRestoreManifest();
initParams.BuildinFileSystemParameters = FileSystemParameters.CreateDefaultBuildinFileSystemParameters(fileDecryption, packageRoot);
initParams.BuildinFileSystemParameters.AddParameter(FileSystemParametersDefine.DISABLE_CATALOG_FILE, true);
- initParams.BuildinFileSystemParameters.AddParameter(FileSystemParametersDefine.MANIFEST_SERVICES, manifestServices);
+ initParams.BuildinFileSystemParameters.AddParameter(FileSystemParametersDefine.MANIFEST_RESTORE_SERVICES, manifestServices);
var initializeOp = package.InitializePackageAsync(initParams);
yield return initializeOp;
if (initializeOp.Status != EOperationStatus.Succeed)
diff --git a/Assets/YooAsset/Samples~/Test Sample/Runtime/T3_TestCacheFileSystem/T3_TestCacheFileSystem.cs b/Assets/YooAsset/Samples~/Test Sample/Runtime/T3_TestCacheFileSystem/T3_TestCacheFileSystem.cs
index d1f9bf57..a6e5f899 100644
--- a/Assets/YooAsset/Samples~/Test Sample/Runtime/T3_TestCacheFileSystem/T3_TestCacheFileSystem.cs
+++ b/Assets/YooAsset/Samples~/Test Sample/Runtime/T3_TestCacheFileSystem/T3_TestCacheFileSystem.cs
@@ -52,7 +52,7 @@ public class T3_TestCacheFileSystem : IPrebuildSetup, IPostBuildCleanup
var remoteServices = new TestRemoteServices(hostServerIP);
initParams.BuildinFileSystemParameters = null;
initParams.CacheFileSystemParameters = FileSystemParameters.CreateDefaultCacheFileSystemParameters(remoteServices, fileDecryption);
- initParams.CacheFileSystemParameters.AddParameter(FileSystemParametersDefine.MANIFEST_SERVICES, manifestServices);
+ initParams.CacheFileSystemParameters.AddParameter(FileSystemParametersDefine.MANIFEST_RESTORE_SERVICES, manifestServices);
var initializeOp = package.InitializePackageAsync(initParams);
yield return initializeOp;
if (initializeOp.Status != EOperationStatus.Succeed)