diff --git a/UnityProject/Packages/YooAsset/CHANGELOG.md b/UnityProject/Packages/YooAsset/CHANGELOG.md
index c4a74152..a87da1ce 100644
--- a/UnityProject/Packages/YooAsset/CHANGELOG.md
+++ b/UnityProject/Packages/YooAsset/CHANGELOG.md
@@ -2,12 +2,117 @@
All notable changes to this package will be documented in this file.
+## [2.3.7] - 2025-04-01
+
+### Improvements
+
+- (#526) 运行时资源清单的哈希值验证兼容了MD5和CRC32两种方式。
+- (#515) 优化了资源路径大小写不敏感的逻辑代码,减少字符串操作产生的GC。
+- (#523) UnloadUnusedAssetsOperation方法支持了分帧处理。
+
+### Fixed
+
+- (#520) 修复了UWP平台获取WWW加载路径未适配的问题。
+
+### Added
+
+- 新增了文件系统初始化参数:INSTALL_CLEAR_MODE
+
+ ```csharp
+ ///
+ /// 覆盖安装清理模式
+ ///
+ public enum EOverwriteInstallClearMode
+ {
+ ///
+ /// 不做任何处理
+ ///
+ None = 0,
+
+ ///
+ /// 清理所有缓存文件(包含资源文件和清单文件)
+ ///
+ ClearAllCacheFiles = 1,
+
+ ///
+ /// 清理所有缓存的资源文件
+ ///
+ ClearAllBundleFiles = 2,
+
+ ///
+ /// 清理所有缓存的清单文件
+ ///
+ ClearAllManifestFiles = 3,
+ }
+ ```
+
+- 新增了初始化参数:BundleLoadingMaxConcurrency
+
+ ```csharp
+ public abstract class InitializeParameters
+ {
+ ///
+ /// 同时加载Bundle文件的最大并发数
+ ///
+ public int BundleLoadingMaxConcurrency = int.MaxValue;
+ }
+ ```
+
+## [2.3.6] - 2025-03-25
+
+### Improvements
+
+- 构建管线新增了TaskCreateCatalog任务节点。
+- 内置文件系统的catalog文件现在存储在streammingAssets目录下。
+
+### Fixed
+
+- (#486) 修复了微信小游戏文件系统调用ClearUnusedBundleFiles时候的异常。
+
+## [2.3.5-preview] - 2025-03-14
+
+### Fixed
+
+- (#502) 修复了原生缓存文件由于文件格式变动导致的加载本地缓存文件失败的问题。
+- (#504) 修复了MacOS平台Offline Play Mode模式请求本地资源清单失败的问题。
+- (#506) 修复了v2.3x版本LoadAllAssets方法计算依赖Bundle不完整的问题。
+- (#506) 修复了微信小游戏文件系统,在启用加密算法后卸载bundle报错的问题。
+
+## [2.3.4-preview] - 2025-03-08
+
+### Improvements
+
+- YooAsset支持了版本宏定义。
+
+ ```csharp
+ YOO_ASSET_2
+ YOO_ASSET_2_3
+ YOO_ASSET_2_3_OR_NEWER
+ ```
+
+### Fixed
+
+- (#389) 修复了禁用域重载(Reload Domain)的情况下,再次启动游戏报错的问题。
+- (#496) 修复了文件系统参数RESUME_DOWNLOAD_MINMUM_SIZE传入int值会导致异常的错误。
+- (#498) 修复了v2.3版本尝试加载安卓包内的原生资源包失败的问题。
+
+### Added
+
+- 新增了YooAssets.GetAllPackages()方法
+
+ ```csharp
+ ///
+ /// 获取所有资源包裹
+ ///
+ public static List GetAllPackages()
+ ```
+
## [2.3.3-preview] - 2025-03-06
### Improvements
- 新增了异步操作任务调试器,AssetBundleDebugger窗口-->OperationView视图模式
-- 编辑器下模拟构建默认启用依赖关系数据库,可以大幅增加编辑器下开始游戏时间。
+- 编辑器下模拟构建默认启用依赖关系数据库,可以大幅降低编辑器下启动游戏的时间。
- 单元测试用例增加加密解密测试用例。
### Fixed
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension.meta b/UnityProject/Packages/YooAsset/Editor/Assembly.meta
similarity index 77%
rename from UnityProject/Packages/YooAsset/Editor/Extension.meta
rename to UnityProject/Packages/YooAsset/Editor/Assembly.meta
index 400f9e28..f146dd2b 100644
--- a/UnityProject/Packages/YooAsset/Editor/Extension.meta
+++ b/UnityProject/Packages/YooAsset/Editor/Assembly.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: caf4d6b8aba38514fa2d00c93b086073
+guid: fab3cd742c11be2479b07f5d447a78c9
folderAsset: yes
DefaultImporter:
externalObjects: {}
diff --git a/UnityProject/Packages/YooAsset/Editor/Assembly/MacroDefine.cs b/UnityProject/Packages/YooAsset/Editor/Assembly/MacroDefine.cs
new file mode 100644
index 00000000..a647b43d
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/Assembly/MacroDefine.cs
@@ -0,0 +1,17 @@
+using System.Collections.Generic;
+
+namespace YooAsset.Editor
+{
+ public class MacroDefine
+ {
+ ///
+ /// YooAsset版本宏定义
+ ///
+ public static readonly List Macros = new List()
+ {
+ "YOO_ASSET_2",
+ "YOO_ASSET_2_3",
+ "YOO_ASSET_2_3_OR_NEWER",
+ };
+ }
+}
diff --git a/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadParam.cs.meta b/UnityProject/Packages/YooAsset/Editor/Assembly/MacroDefine.cs.meta
similarity index 83%
rename from UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadParam.cs.meta
rename to UnityProject/Packages/YooAsset/Editor/Assembly/MacroDefine.cs.meta
index 85286202..4224cd37 100644
--- a/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadParam.cs.meta
+++ b/UnityProject/Packages/YooAsset/Editor/Assembly/MacroDefine.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 56ea224b45d314e4a86b558404e9b6c8
+guid: a61e5c2ca04aab647b1ed0492086aa8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/UnityProject/Packages/YooAsset/Editor/Assembly/MacroProcessor.cs b/UnityProject/Packages/YooAsset/Editor/Assembly/MacroProcessor.cs
new file mode 100644
index 00000000..265fc1e6
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/Assembly/MacroProcessor.cs
@@ -0,0 +1,96 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using UnityEditor;
+
+namespace YooAsset.Editor
+{
+ [InitializeOnLoad]
+ public class MacroProcessor : AssetPostprocessor
+ {
+ static string OnGeneratedCSProject(string path, string content)
+ {
+ XmlDocument xmlDoc = new XmlDocument();
+ xmlDoc.LoadXml(content);
+
+ if (IsCSProjectReferenced(xmlDoc.DocumentElement) == false)
+ return content;
+
+ if (ProcessDefineConstants(xmlDoc.DocumentElement) == false)
+ return content;
+
+ // 将修改后的XML结构重新输出为文本
+ var stringWriter = new StringWriter();
+ var writerSettings = new XmlWriterSettings();
+ writerSettings.Indent = true;
+ var xmlWriter = XmlWriter.Create(stringWriter, writerSettings);
+ xmlDoc.WriteTo(xmlWriter);
+ xmlWriter.Flush();
+ return stringWriter.ToString();
+ }
+
+ ///
+ /// 处理宏定义
+ ///
+ private static bool ProcessDefineConstants(XmlElement element)
+ {
+ if (element == null)
+ return false;
+
+ bool processed = false;
+ foreach (XmlNode node in element.ChildNodes)
+ {
+ if (node.Name != "PropertyGroup")
+ continue;
+
+ foreach (XmlNode childNode in node.ChildNodes)
+ {
+ if (childNode.Name != "DefineConstants")
+ continue;
+
+ string[] defines = childNode.InnerText.Split(';');
+ HashSet hashSets = new HashSet(defines);
+ foreach (string yooMacro in MacroDefine.Macros)
+ {
+ string tmpMacro = yooMacro.Trim();
+ if (hashSets.Contains(tmpMacro) == false)
+ hashSets.Add(tmpMacro);
+ }
+ childNode.InnerText = string.Join(";", hashSets.ToArray());
+ processed = true;
+ }
+ }
+
+ return processed;
+ }
+
+ ///
+ /// 检测工程是否引用了YooAsset
+ ///
+ private static bool IsCSProjectReferenced(XmlElement element)
+ {
+ if (element == null)
+ return false;
+
+ foreach (XmlNode node in element.ChildNodes)
+ {
+ if (node.Name != "ItemGroup")
+ continue;
+
+ foreach (XmlNode childNode in node.ChildNodes)
+ {
+ if (childNode.Name != "Reference" && childNode.Name != "ProjectReference")
+ continue;
+
+ string include = childNode.Attributes["Include"].Value;
+ if (include.Contains("YooAsset"))
+ return true;
+ }
+ }
+
+ return false;
+ }
+ }
+}
diff --git a/UnityProject/Packages/YooAsset/Editor/Assembly/MacroProcessor.cs.meta b/UnityProject/Packages/YooAsset/Editor/Assembly/MacroProcessor.cs.meta
new file mode 100644
index 00000000..89d654cd
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/Assembly/MacroProcessor.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 88d5a41d078a82e40b82265ed4c3631a
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Editor/Assembly/RspGenerator.cs b/UnityProject/Packages/YooAsset/Editor/Assembly/RspGenerator.cs
new file mode 100644
index 00000000..7b199f04
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/Assembly/RspGenerator.cs
@@ -0,0 +1,115 @@
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using UnityEditor;
+using UnityEngine;
+
+#if YOO_ASSET_EXPERIMENT
+namespace YooAsset.Editor.Experiment
+{
+ [InitializeOnLoad]
+ public class RspGenerator
+ {
+ // csc.rsp文件路径
+ private static string RspFilePath => Path.Combine(Application.dataPath, "csc.rsp");
+
+ static RspGenerator()
+ {
+ UpdateRspFile(MacroDefine.Macros, null);
+ }
+
+ ///
+ /// 更新csc.rsp文件
+ ///
+ private static void UpdateRspFile(List addMacros, List removeMacros)
+ {
+ var existingDefines = new HashSet();
+ var otherLines = new List();
+
+ // 1. 读取现有内容
+ ReadRspFile(existingDefines, otherLines);
+
+ // 2. 添加新宏
+ if (addMacros != null && addMacros.Count > 0)
+ {
+ addMacros.ForEach(x =>
+ {
+ if (existingDefines.Contains(x) == false)
+ existingDefines.Add(x);
+ });
+ }
+
+ // 3. 移除指定宏
+ if (removeMacros != null && removeMacros.Count > 0)
+ {
+ removeMacros.ForEach(x =>
+ {
+ existingDefines.Remove(x);
+ });
+ }
+
+ // 4. 重新生成内容
+ WriteRspFile(existingDefines, otherLines);
+
+ // 5. 刷新AssetDatabase
+ AssetDatabase.Refresh();
+ EditorUtility.RequestScriptReload();
+ }
+
+ ///
+ /// 读取csc.rsp文件,返回宏定义和其他行
+ ///
+ private static void ReadRspFile(HashSet defines, List others)
+ {
+ if (defines == null)
+ defines = new HashSet();
+
+ if (others == null)
+ others = new List();
+
+ if (File.Exists(RspFilePath) == false)
+ return;
+
+ foreach (string line in File.ReadAllLines(RspFilePath))
+ {
+ if (line.StartsWith("-define:"))
+ {
+ string[] parts = line.Split(new[] { ':' }, 2);
+ if (parts.Length == 2)
+ {
+ defines.Add(parts[1].Trim());
+ }
+ }
+ else
+ {
+ others.Add(line);
+ }
+ }
+ }
+
+ ///
+ /// 重新写入csc.rsp文件
+ ///
+ private static void WriteRspFile(HashSet defines, List others)
+ {
+ StringBuilder sb = new StringBuilder();
+ if (others != null && others.Count > 0)
+ {
+ others.ForEach(o => sb.AppendLine(o));
+ }
+
+ if (defines != null && defines.Count > 0)
+ {
+ foreach (string define in defines)
+ {
+ sb.AppendLine($"-define:{define}");
+ }
+ }
+
+ File.WriteAllText(RspFilePath, sb.ToString());
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Editor/Assembly/RspGenerator.cs.meta b/UnityProject/Packages/YooAsset/Editor/Assembly/RspGenerator.cs.meta
new file mode 100644
index 00000000..dc436a4a
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/Assembly/RspGenerator.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c2662e1d33b1eea469695b68d18b1739
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs
new file mode 100644
index 00000000..67dabdde
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs
@@ -0,0 +1,23 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEditor;
+
+namespace YooAsset.Editor
+{
+ public class TaskCreateCatalog
+ {
+ ///
+ /// 生成内置资源记录文件
+ ///
+ internal void CreateCatalogFile(BuildParametersContext buildParametersContext)
+ {
+ string buildinRootDirectory = buildParametersContext.GetBuildinRootDirectory();
+ string buildPackageName = buildParametersContext.Parameters.PackageName;
+ DefaultBuildinFileSystemBuild.CreateBuildinCatalogFile(buildPackageName, buildinRootDirectory);
+
+ // 刷新目录
+ AssetDatabase.Refresh();
+ }
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs.meta b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs.meta
new file mode 100644
index 00000000..60ceae1c
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateCatalog.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 2d2c835e5e40ca34d93480587c8125df
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
index b026ff35..a23dd021 100644
--- a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BaseTasks/TaskCreateManifest.cs
@@ -30,7 +30,7 @@ namespace YooAsset.Editor
// 创建新补丁清单
PackageManifest manifest = new PackageManifest();
- manifest.FileVersion = YooAssetSettings.ManifestFileVersion;
+ manifest.FileVersion = ManifestDefine.FileVersion;
manifest.EnableAddressable = buildMapContext.Command.EnableAddressable;
manifest.LocationToLower = buildMapContext.Command.LocationToLower;
manifest.IncludeAssetGUID = buildMapContext.Command.IncludeAssetGUID;
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateCatalog_BBP.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateCatalog_BBP.cs
new file mode 100644
index 00000000..88ea3ec4
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateCatalog_BBP.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+
+namespace YooAsset.Editor
+{
+ public class TaskCreateCatalog_BBP : TaskCreateCatalog, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
+ {
+ CreateCatalogFile(buildParametersContext);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateCatalog_BBP.cs.meta b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateCatalog_BBP.cs.meta
new file mode 100644
index 00000000..af3711b3
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuildTasks/TaskCreateCatalog_BBP.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8fe3d00b03dc9c64a96b7acfdf99b54c
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs
index 3341a922..21168628 100644
--- a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/BuiltinBuildPipeline/BuiltinBuildPipeline.cs
@@ -36,6 +36,7 @@ namespace YooAsset.Editor
new TaskCreateReport_BBP(),
new TaskCreatePackage_BBP(),
new TaskCopyBuildinFiles_BBP(),
+ new TaskCreateCatalog_BBP()
};
return pipeline;
}
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateCatalog_RFBP.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateCatalog_RFBP.cs
new file mode 100644
index 00000000..4896bc5c
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateCatalog_RFBP.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+
+namespace YooAsset.Editor
+{
+ public class TaskCreateCatalog_RFBP : TaskCreateCatalog, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
+ {
+ CreateCatalogFile(buildParametersContext);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateCatalog_RFBP.cs.meta b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateCatalog_RFBP.cs.meta
new file mode 100644
index 00000000..35e494d6
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/BuildTasks/TaskCreateCatalog_RFBP.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 563771ecaff17ee498b5fda7c1132e62
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs
index 8358e918..38627bea 100644
--- a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/RawFileBuildPipeline/RawFileBuildPipeline.cs
@@ -38,6 +38,7 @@ namespace YooAsset.Editor
new TaskCreateReport_RFBP(),
new TaskCreatePackage_RFBP(),
new TaskCopyBuildinFiles_RFBP(),
+ new TaskCreateCatalog_RFBP()
};
return pipeline;
}
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateCatalog_SBP.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateCatalog_SBP.cs
new file mode 100644
index 00000000..370da5e5
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateCatalog_SBP.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEditor;
+using UnityEngine;
+
+namespace YooAsset.Editor
+{
+ public class TaskCreateCatalog_SBP : TaskCreateCatalog, IBuildTask
+ {
+ void IBuildTask.Run(BuildContext context)
+ {
+ var buildParametersContext = context.GetContextObject();
+ if (buildParametersContext.Parameters.BuildinFileCopyOption != EBuildinFileCopyOption.None)
+ {
+ CreateCatalogFile(buildParametersContext);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateCatalog_SBP.cs.meta b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateCatalog_SBP.cs.meta
new file mode 100644
index 00000000..aec72834
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/BuildTasks/TaskCreateCatalog_SBP.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: d8241b1eb8e22874b84d279dae9bbd1b
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/ScriptableBuildPipeline.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/ScriptableBuildPipeline.cs
index 1e87ab90..cab36611 100644
--- a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/ScriptableBuildPipeline.cs
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/BuildPipeline/ScriptableBuildPipeline/ScriptableBuildPipeline.cs
@@ -36,6 +36,7 @@ namespace YooAsset.Editor
new TaskCreateReport_SBP(),
new TaskCreatePackage_SBP(),
new TaskCopyBuildinFiles_SBP(),
+ new TaskCreateCatalog_SBP()
};
return pipeline;
}
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultIgnoreRule.cs b/UnityProject/Packages/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultIgnoreRule.cs
index 36172444..7ab28e04 100644
--- a/UnityProject/Packages/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultIgnoreRule.cs
+++ b/UnityProject/Packages/YooAsset/Editor/AssetBundleCollector/DefaultRules/DefaultIgnoreRule.cs
@@ -10,7 +10,7 @@ namespace YooAsset.Editor
///
/// 忽略的文件类型
///
- public readonly static HashSet IgnoreFileExtensions = new HashSet() { "", ".so", ".dll", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
+ public readonly static HashSet IgnoreFileExtensions = new HashSet() { "", ".so", ".cs", ".js", ".boo", ".meta", ".cginc", ".hlsl" };
}
///
diff --git a/UnityProject/Packages/YooAsset/EditorExtension.meta b/UnityProject/Packages/YooAsset/EditorExtension.meta
new file mode 100644
index 00000000..caaa150f
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/EditorExtension.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: b06ab19560638014094f5cf14a1e05bf
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/CustomRules.meta b/UnityProject/Packages/YooAsset/EditorExtension/CustomRules.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/CustomRules.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/CustomRules.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/CustomRules/CustomAdressRule.cs b/UnityProject/Packages/YooAsset/EditorExtension/CustomRules/CustomAdressRule.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/CustomRules/CustomAdressRule.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/CustomRules/CustomAdressRule.cs
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/CustomRules/CustomAdressRule.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/CustomRules/CustomAdressRule.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/CustomRules/CustomAdressRule.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/CustomRules/CustomAdressRule.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/CustomRules/CustomPackRule.cs b/UnityProject/Packages/YooAsset/EditorExtension/CustomRules/CustomPackRule.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/CustomRules/CustomPackRule.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/CustomRules/CustomPackRule.cs
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/CustomRules/CustomPackRule.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/CustomRules/CustomPackRule.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/CustomRules/CustomPackRule.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/CustomRules/CustomPackRule.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/PackageComparator.meta b/UnityProject/Packages/YooAsset/EditorExtension/PackageComparator.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/PackageComparator.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/PackageComparator.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/PackageComparator/PackageComparatorWindow.cs b/UnityProject/Packages/YooAsset/EditorExtension/PackageComparator/PackageComparatorWindow.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/PackageComparator/PackageComparatorWindow.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/PackageComparator/PackageComparatorWindow.cs
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/PackageComparator/PackageComparatorWindow.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/PackageComparator/PackageComparatorWindow.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/PackageComparator/PackageComparatorWindow.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/PackageComparator/PackageComparatorWindow.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/PackageImporter.meta b/UnityProject/Packages/YooAsset/EditorExtension/PackageImporter.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/PackageImporter.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/PackageImporter.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/PackageImporter/PackageImporterWindow.cs b/UnityProject/Packages/YooAsset/EditorExtension/PackageImporter/PackageImporterWindow.cs
similarity index 98%
rename from UnityProject/Packages/YooAsset/Editor/Extension/PackageImporter/PackageImporterWindow.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/PackageImporter/PackageImporterWindow.cs
index 9d53e283..6e692c60 100644
--- a/UnityProject/Packages/YooAsset/Editor/Extension/PackageImporter/PackageImporterWindow.cs
+++ b/UnityProject/Packages/YooAsset/EditorExtension/PackageImporter/PackageImporterWindow.cs
@@ -51,10 +51,6 @@ namespace YooAsset.Editor
string manifestFileName = Path.GetFileNameWithoutExtension(manifestFilePath);
string outputDirectory = Path.GetDirectoryName(manifestFilePath);
- // 加载补丁清单
- byte[] bytesData = FileUtility.ReadAllBytes(manifestFilePath);
- PackageManifest manifest = ManifestTools.DeserializeFromBinary(bytesData);
-
// 拷贝核心文件
{
string sourcePath = $"{outputDirectory}/{manifestFileName}.bytes";
@@ -67,12 +63,16 @@ namespace YooAsset.Editor
EditorTools.CopyFile(sourcePath, destPath, true);
}
{
- string fileName = YooAssetSettingsData.GetPackageVersionFileName(manifest.PackageName);
+ string fileName = YooAssetSettingsData.GetPackageVersionFileName(_packageName);
string sourcePath = $"{outputDirectory}/{fileName}";
string destPath = $"{AssetBundleBuilderHelper.GetStreamingAssetsRoot()}/{_packageName}/{fileName}";
EditorTools.CopyFile(sourcePath, destPath, true);
}
+ // 加载补丁清单
+ byte[] bytesData = FileUtility.ReadAllBytes(manifestFilePath);
+ PackageManifest manifest = ManifestTools.DeserializeFromBinary(bytesData);
+
// 拷贝文件列表
int fileCount = 0;
foreach (var packageBundle in manifest.BundleList)
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/PackageImporter/PackageImporterWindow.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/PackageImporter/PackageImporterWindow.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/PackageImporter/PackageImporterWindow.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/PackageImporter/PackageImporterWindow.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector.meta b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectionHelper.cs b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectionHelper.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectionHelper.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectionHelper.cs
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectionHelper.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectionHelper.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectionHelper.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectionHelper.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectionManifest.cs b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectionManifest.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectionManifest.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectionManifest.cs
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectionManifest.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectionManifest.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectionManifest.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectionManifest.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollector.cs b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollector.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollector.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollector.cs
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollector.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollector.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollector.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollector.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorSetting.cs b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorSetting.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorSetting.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorSetting.cs
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorSetting.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorSetting.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorSetting.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorSetting.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorWindow.cs b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorWindow.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorWindow.cs
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorWindow.cs
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorWindow.cs.meta b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorWindow.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorWindow.cs.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorWindow.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorWindow.uxml b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorWindow.uxml
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorWindow.uxml
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorWindow.uxml
diff --git a/UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorWindow.uxml.meta b/UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorWindow.uxml.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Editor/Extension/ShaderVariantCollector/ShaderVariantCollectorWindow.uxml.meta
rename to UnityProject/Packages/YooAsset/EditorExtension/ShaderVariantCollector/ShaderVariantCollectorWindow.uxml.meta
diff --git a/UnityProject/Packages/YooAsset/EditorExtension/YooAsset.EditorExtension.asmdef b/UnityProject/Packages/YooAsset/EditorExtension/YooAsset.EditorExtension.asmdef
new file mode 100644
index 00000000..fe6e65fe
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/EditorExtension/YooAsset.EditorExtension.asmdef
@@ -0,0 +1,21 @@
+{
+ "name": "YooAsset.EditorExtension",
+ "rootNamespace": "",
+ "references": [
+ "YooAsset",
+ "Unity.ScriptableBuildPipeline",
+ "Unity.ScriptableBuildPipeline.Editor",
+ "YooAsset.Editor"
+ ],
+ "includePlatforms": [
+ "Editor"
+ ],
+ "excludePlatforms": [],
+ "allowUnsafeCode": false,
+ "overrideReferences": false,
+ "precompiledReferences": [],
+ "autoReferenced": true,
+ "defineConstraints": [],
+ "versionDefines": [],
+ "noEngineReferences": false
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/EditorExtension/YooAsset.EditorExtension.asmdef.meta b/UnityProject/Packages/YooAsset/EditorExtension/YooAsset.EditorExtension.asmdef.meta
new file mode 100644
index 00000000..67d19990
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/EditorExtension/YooAsset.EditorExtension.asmdef.meta
@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 281f3f16cd2cf7944b9b7886a4c9a40f
+AssemblyDefinitionImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Runtime/Assembly.meta b/UnityProject/Packages/YooAsset/Runtime/Assembly.meta
new file mode 100644
index 00000000..10289501
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/Assembly.meta
@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: 569f60ef80f74a642bac91eca0b20a2b
+folderAsset: yes
+DefaultImporter:
+ externalObjects: {}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Runtime/AssemblyInfo.cs b/UnityProject/Packages/YooAsset/Runtime/Assembly/AssemblyInfo.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Runtime/AssemblyInfo.cs
rename to UnityProject/Packages/YooAsset/Runtime/Assembly/AssemblyInfo.cs
diff --git a/UnityProject/Packages/YooAsset/Runtime/AssemblyInfo.cs.meta b/UnityProject/Packages/YooAsset/Runtime/Assembly/AssemblyInfo.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Runtime/AssemblyInfo.cs.meta
rename to UnityProject/Packages/YooAsset/Runtime/Assembly/AssemblyInfo.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemoteDebuggerInRuntime.cs b/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemoteDebuggerInRuntime.cs
index b41c5485..2c8b5d7b 100644
--- a/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemoteDebuggerInRuntime.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemoteDebuggerInRuntime.cs
@@ -7,6 +7,15 @@ namespace YooAsset
{
internal class RemoteDebuggerInRuntime : MonoBehaviour
{
+#if UNITY_EDITOR
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ _sampleOnce = false;
+ _autoSample = false;
+ }
+#endif
+
private static bool _sampleOnce = false;
private static bool _autoSample = false;
diff --git a/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemoteEditorConnection.cs b/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemoteEditorConnection.cs
index fe388a59..9b8cbb53 100644
--- a/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemoteEditorConnection.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemoteEditorConnection.cs
@@ -8,6 +8,14 @@ namespace YooAsset
{
internal class RemoteEditorConnection
{
+#if UNITY_EDITOR
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ _instance = null;
+ }
+#endif
+
private static RemoteEditorConnection _instance;
public static RemoteEditorConnection Instance
{
diff --git a/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemotePlayerConnection.cs b/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemotePlayerConnection.cs
index 05f8db53..5522bda9 100644
--- a/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemotePlayerConnection.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/DiagnosticSystem/RemotePlayerConnection.cs
@@ -8,6 +8,14 @@ namespace YooAsset
{
internal class RemotePlayerConnection
{
+#if UNITY_EDITOR
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ _instance = null;
+ }
+#endif
+
private static RemotePlayerConnection _instance;
public static RemotePlayerConnection Instance
{
diff --git a/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadParam.cs b/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadParam.cs
deleted file mode 100644
index 08efef4c..00000000
--- a/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadParam.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-
-namespace YooAsset
-{
- internal class DownloadParam
- {
- public readonly int FailedTryAgain;
- public readonly int Timeout;
-
- ///
- /// 导入的本地文件路径
- ///
- public string ImportFilePath { set; get; }
-
- ///
- /// 主资源地址
- ///
- public string MainURL { set; get; }
-
- ///
- /// 备用资源地址
- ///
- public string FallbackURL { set; get; }
-
- public DownloadParam(int failedTryAgain, int timeout)
- {
- FailedTryAgain = failedTryAgain;
- Timeout = timeout;
- }
- }
-}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs b/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs
index bd1f24e8..e127f351 100644
--- a/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs
@@ -1,4 +1,5 @@
using UnityEngine.Networking;
+using UnityEngine;
namespace YooAsset
{
@@ -9,6 +10,14 @@ namespace YooAsset
internal class DownloadSystemHelper
{
+#if UNITY_EDITOR
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ UnityWebRequestCreater = null;
+ }
+#endif
+
public static UnityWebRequestDelegate UnityWebRequestCreater = null;
public static UnityWebRequest NewUnityWebRequestGet(string requestURL)
{
@@ -28,7 +37,9 @@ namespace YooAsset
string url;
// 获取对应平台的URL地址
-#if UNITY_EDITOR
+#if UNITY_EDITOR_OSX
+ url = StringUtility.Format("file://{0}", path);
+#elif UNITY_EDITOR
url = StringUtility.Format("file:///{0}", path);
#elif UNITY_WEBGL
url = path;
@@ -56,7 +67,7 @@ namespace YooAsset
}
#elif UNITY_STANDALONE_OSX
url = new System.Uri(path).ToString();
-#elif UNITY_STANDALONE
+#elif UNITY_STANDALONE || UNITY_WSA
url = StringUtility.Format("file:///{0}", path);
#else
throw new System.NotImplementedException();
diff --git a/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/WebRequestCounter.cs b/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/WebRequestCounter.cs
index 0c962d91..72984b55 100644
--- a/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/WebRequestCounter.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/DownloadSystem/WebRequestCounter.cs
@@ -6,6 +6,14 @@ namespace YooAsset
{
internal class WebRequestCounter
{
+#if UNITY_EDITOR
+ [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ _requestFailedRecorder.Clear();
+ }
+#endif
+
///
/// 记录网络请求失败事件的次数
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs
new file mode 100644
index 00000000..918e7718
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs
@@ -0,0 +1,21 @@
+
+namespace YooAsset
+{
+ internal class CatalogDefine
+ {
+ ///
+ /// 文件极限大小(100MB)
+ ///
+ public const int FileMaxSize = 104857600;
+
+ ///
+ /// 文件头标记
+ ///
+ public const uint FileSign = 0x133C5EE;
+
+ ///
+ /// 文件格式版本
+ ///
+ public const string FileVersion = "1.0.0";
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs.meta b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs.meta
new file mode 100644
index 00000000..f03166e5
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogDefine.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c6be7b8be0b51784997c959b370193e9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs
new file mode 100644
index 00000000..0d45e132
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs
@@ -0,0 +1,102 @@
+using System;
+using System.IO;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace YooAsset
+{
+ internal static class CatalogTools
+ {
+ ///
+ /// 序列化(JSON文件)
+ ///
+ public static void SerializeToJson(string savePath, DefaultBuildinFileCatalog catalog)
+ {
+ string json = JsonUtility.ToJson(catalog, true);
+ FileUtility.WriteAllText(savePath, json);
+ }
+
+ ///
+ /// 反序列化(JSON文件)
+ ///
+ public static DefaultBuildinFileCatalog DeserializeFromJson(string jsonContent)
+ {
+ return JsonUtility.FromJson(jsonContent);
+ }
+
+ ///
+ /// 序列化(二进制文件)
+ ///
+ public static void SerializeToBinary(string savePath, DefaultBuildinFileCatalog catalog)
+ {
+ using (FileStream fs = new FileStream(savePath, FileMode.Create))
+ {
+ // 创建缓存器
+ BufferWriter buffer = new BufferWriter(CatalogDefine.FileMaxSize);
+
+ // 写入文件标记
+ buffer.WriteUInt32(CatalogDefine.FileSign);
+
+ // 写入文件版本
+ buffer.WriteUTF8(CatalogDefine.FileVersion);
+
+ // 写入文件头信息
+ buffer.WriteUTF8(catalog.PackageName);
+ buffer.WriteUTF8(catalog.PackageVersion);
+
+ // 写入资源包列表
+ buffer.WriteInt32(catalog.Wrappers.Count);
+ for (int i = 0; i < catalog.Wrappers.Count; i++)
+ {
+ var fileWrapper = catalog.Wrappers[i];
+ buffer.WriteUTF8(fileWrapper.BundleGUID);
+ buffer.WriteUTF8(fileWrapper.FileName);
+ }
+
+ // 写入文件流
+ buffer.WriteToStream(fs);
+ fs.Flush();
+ }
+ }
+
+ ///
+ /// 反序列化(二进制文件)
+ ///
+ public static DefaultBuildinFileCatalog DeserializeFromBinary(byte[] binaryData)
+ {
+ // 创建缓存器
+ BufferReader buffer = new BufferReader(binaryData);
+
+ // 读取文件标记
+ uint fileSign = buffer.ReadUInt32();
+ if (fileSign != CatalogDefine.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}");
+
+ DefaultBuildinFileCatalog catalog = new DefaultBuildinFileCatalog();
+ {
+ // 读取文件头信息
+ catalog.FileVersion = fileVersion;
+ catalog.PackageName = buffer.ReadUTF8();
+ catalog.PackageVersion = buffer.ReadUTF8();
+
+ // 读取资源包列表
+ int fileCount = buffer.ReadInt32();
+ catalog.Wrappers = new List(fileCount);
+ for (int i = 0; i < fileCount; i++)
+ {
+ var fileWrapper = new DefaultBuildinFileCatalog.FileWrapper();
+ fileWrapper.BundleGUID = buffer.ReadUTF8();
+ fileWrapper.FileName = buffer.ReadUTF8();
+ catalog.Wrappers.Add(fileWrapper);
+ }
+ }
+
+ return catalog;
+ }
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs.meta b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs.meta
new file mode 100644
index 00000000..ca5dd4b7
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/CatalogTools.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: cf87ffe3b3de69942ac16640a330dd37
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileCatalog.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileCatalog.cs
index bc991a86..6c59e986 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileCatalog.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileCatalog.cs
@@ -1,27 +1,27 @@
using System;
+using System.IO;
using System.Collections.Generic;
-using UnityEngine;
namespace YooAsset
{
///
/// 内置资源清单目录
///
- internal class DefaultBuildinFileCatalog : ScriptableObject
+ [Serializable]
+ internal class DefaultBuildinFileCatalog
{
[Serializable]
public class FileWrapper
{
public string BundleGUID;
public string FileName;
-
- public FileWrapper(string bundleGUID, string fileName)
- {
- BundleGUID = bundleGUID;
- FileName = fileName;
- }
}
+ ///
+ /// 文件版本
+ ///
+ public string FileVersion;
+
///
/// 包裹名称
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
index 56d1ef5e..d061b6ea 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystem.cs
@@ -58,6 +58,11 @@ namespace YooAsset
///
public EFileVerifyLevel FileVerifyLevel { private set; get; } = EFileVerifyLevel.Middle;
+ ///
+ /// 自定义参数:覆盖安装缓存清理模式
+ ///
+ public EOverwriteInstallClearMode InstallClearMode { private set; get; } = EOverwriteInstallClearMode.ClearAllManifestFiles;
+
///
/// 自定义参数:数据文件追加文件格式
///
@@ -104,15 +109,15 @@ namespace YooAsset
var operation = new DBFSRequestPackageVersionOperation(this);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
{
- return _unpackFileSystem.ClearCacheFilesAsync(manifest, clearMode, clearParam);
+ return _unpackFileSystem.ClearCacheFilesAsync(manifest, options);
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
+ public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
// 注意:业务层的解压下载器会依赖内置文件系统的下载方法
- param.ImportFilePath = GetBuildinFileLoadPath(bundle);
- return _unpackFileSystem.DownloadFileAsync(bundle, param);
+ options.ImportFilePath = GetBuildinFileLoadPath(bundle);
+ return _unpackFileSystem.DownloadFileAsync(bundle, options);
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
{
@@ -145,17 +150,21 @@ namespace YooAsset
{
FileVerifyLevel = (EFileVerifyLevel)value;
}
+ else if (name == FileSystemParametersDefine.INSTALL_CLEAR_MODE)
+ {
+ InstallClearMode = (EOverwriteInstallClearMode)value;
+ }
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
{
- AppendFileExtension = (bool)value;
+ AppendFileExtension = Convert.ToBoolean(value);
}
else if (name == FileSystemParametersDefine.DISABLE_CATALOG_FILE)
{
- DisableCatalogFile = (bool)value;
+ DisableCatalogFile = Convert.ToBoolean(value);
}
else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST)
{
- CopyBuildinPackageManifest = (bool)value;
+ CopyBuildinPackageManifest = Convert.ToBoolean(value);
}
else if (name == FileSystemParametersDefine.COPY_BUILDIN_PACKAGE_MANIFEST_DEST_ROOT)
{
@@ -184,6 +193,7 @@ namespace YooAsset
_unpackFileSystem = new DefaultUnpackFileSystem();
_unpackFileSystem.SetParameter(FileSystemParametersDefine.REMOTE_SERVICES, remoteServices);
_unpackFileSystem.SetParameter(FileSystemParametersDefine.FILE_VERIFY_LEVEL, FileVerifyLevel);
+ _unpackFileSystem.SetParameter(FileSystemParametersDefine.INSTALL_CLEAR_MODE, InstallClearMode);
_unpackFileSystem.SetParameter(FileSystemParametersDefine.APPEND_FILE_EXTENSION, AppendFileExtension);
_unpackFileSystem.SetParameter(FileSystemParametersDefine.DECRYPTION_SERVICES, DecryptionServices);
_unpackFileSystem.OnCreate(packageName, null);
@@ -239,6 +249,11 @@ namespace YooAsset
if (Exists(bundle) == false)
return null;
+#if UNITY_ANDROID
+ //TODO : 安卓平台内置文件属于APK压缩包内的文件。
+ YooLogger.Error($"Android platform not support read buildin bundle file data !");
+ return null;
+#else
if (bundle.Encrypted)
{
if (DecryptionServices == null)
@@ -261,6 +276,7 @@ namespace YooAsset
string filePath = GetBuildinFileLoadPath(bundle);
return FileUtility.ReadAllBytes(filePath);
}
+#endif
}
public virtual string ReadBundleFileText(PackageBundle bundle)
{
@@ -270,6 +286,11 @@ namespace YooAsset
if (Exists(bundle) == false)
return null;
+#if UNITY_ANDROID
+ //TODO : 安卓平台内置文件属于APK压缩包内的文件。
+ YooLogger.Error($"Android platform not support read buildin bundle file text !");
+ return null;
+#else
if (bundle.Encrypted)
{
if (DecryptionServices == null)
@@ -292,6 +313,7 @@ namespace YooAsset
string filePath = GetBuildinFileLoadPath(bundle);
return FileUtility.ReadAllText(filePath);
}
+#endif
}
#region 内部方法
@@ -324,10 +346,9 @@ namespace YooAsset
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
return PathUtility.Combine(_packageRoot, fileName);
}
- public string GetCatalogFileLoadPath()
+ public string GetCatalogBinaryFileLoadPath()
{
- string fileName = Path.GetFileNameWithoutExtension(DefaultBuildinFileSystemDefine.BuildinCatalogFileName);
- return YooAssetSettingsData.GetYooResourcesLoadPath(PackageName, fileName);
+ return PathUtility.Combine(_packageRoot, DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName);
}
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemBuild.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemBuild.cs
index b117f411..8ac5b494 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemBuild.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemBuild.cs
@@ -17,10 +17,6 @@ namespace YooAsset
{
YooLogger.Log("Begin to create catalog file !");
- string savePath = YooAssetSettingsData.GetYooResourcesFullPath();
- if (UnityEditor.AssetDatabase.DeleteAsset(savePath))
- UnityEditor.AssetDatabase.Refresh();
-
string rootPath = YooAssetSettingsData.GetYooDefaultBuildinRoot();
DirectoryInfo rootDirectory = new DirectoryInfo(rootPath);
if (rootDirectory.Exists == false)
@@ -87,10 +83,25 @@ namespace YooAsset
}
// 创建内置清单实例
- var buildinFileCatalog = ScriptableObject.CreateInstance();
+ var buildinFileCatalog = new DefaultBuildinFileCatalog();
+ buildinFileCatalog.FileVersion = CatalogDefine.FileVersion;
buildinFileCatalog.PackageName = packageName;
buildinFileCatalog.PackageVersion = packageVersion;
+ // 创建白名单查询集合
+ HashSet whiteFileList = new HashSet
+ {
+ "link.xml",
+ "buildlogtep.json",
+ $"{packageName}.version",
+ $"{packageName}_{packageVersion}.bytes",
+ $"{packageName}_{packageVersion}.hash",
+ $"{packageName}_{packageVersion}.json",
+ $"{packageName}_{packageVersion}.report",
+ DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName,
+ DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName
+ };
+
// 记录所有内置资源文件
DirectoryInfo rootDirectory = new DirectoryInfo(pacakgeDirectory);
FileInfo[] fileInfos = rootDirectory.GetFiles();
@@ -99,23 +110,15 @@ namespace YooAsset
if (fileInfo.Extension == ".meta")
continue;
- if (fileInfo.Name == "link.xml" || fileInfo.Name == "buildlogtep.json")
- continue;
- if (fileInfo.Name == $"{packageName}.version")
- continue;
- if (fileInfo.Name == $"{packageName}_{packageVersion}.bytes")
- continue;
- if (fileInfo.Name == $"{packageName}_{packageVersion}.hash")
- continue;
- if (fileInfo.Name == $"{packageName}_{packageVersion}.json")
- continue;
- if (fileInfo.Name == $"{packageName}_{packageVersion}.report")
+ if (whiteFileList.Contains(fileInfo.Name))
continue;
string fileName = fileInfo.Name;
if (fileMapping.TryGetValue(fileName, out string bundleGUID))
{
- var wrapper = new DefaultBuildinFileCatalog.FileWrapper(bundleGUID, fileName);
+ var wrapper = new DefaultBuildinFileCatalog.FileWrapper();
+ wrapper.BundleGUID = bundleGUID;
+ wrapper.FileName = fileName;
buildinFileCatalog.Wrappers.Add(wrapper);
}
else
@@ -124,21 +127,20 @@ namespace YooAsset
}
}
- // 创建输出目录
- string fullPath = YooAssetSettingsData.GetYooResourcesFullPath();
- string saveFilePath = $"{fullPath}/{packageName}/{DefaultBuildinFileSystemDefine.BuildinCatalogFileName}";
- FileUtility.CreateFileDirectory(saveFilePath);
+ // 创建输出文件
+ string jsonFilePath = $"{pacakgeDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogJsonFileName}";
+ if (File.Exists(jsonFilePath))
+ File.Delete(jsonFilePath);
+ CatalogTools.SerializeToJson(jsonFilePath, buildinFileCatalog);
// 创建输出文件
- UnityEditor.AssetDatabase.CreateAsset(buildinFileCatalog, saveFilePath);
- UnityEditor.EditorUtility.SetDirty(buildinFileCatalog);
-#if UNITY_2019
- UnityEditor.AssetDatabase.SaveAssets();
-#else
- UnityEditor.AssetDatabase.SaveAssetIfDirty(buildinFileCatalog);
-#endif
+ string binaryFilePath = $"{pacakgeDirectory}/{DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName}";
+ if (File.Exists(binaryFilePath))
+ File.Delete(binaryFilePath);
+ CatalogTools.SerializeToBinary(binaryFilePath, buildinFileCatalog);
- Debug.Log($"Succeed to save buildin file catalog : {saveFilePath}");
+ UnityEditor.AssetDatabase.Refresh();
+ Debug.Log($"Succeed to save buildin file catalog : {binaryFilePath}");
return true;
}
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemDefine.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemDefine.cs
index 876e01d2..59a67980 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemDefine.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/DefaultBuildinFileSystemDefine.cs
@@ -4,8 +4,13 @@ namespace YooAsset
internal class DefaultBuildinFileSystemDefine
{
///
- /// 内置清单文件名称
+ /// 内置清单JSON文件名称
///
- public const string BuildinCatalogFileName = "BuildinCatalog.asset";
+ public const string BuildinCatalogJsonFileName = "BuildinCatalog.json";
+
+ ///
+ /// 内置清单二进制文件名称
+ ///
+ public const string BuildinCatalogBinaryFileName = "BuildinCatalog.bytes";
}
}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
index 296763e8..7abc7aed 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/DBFSLoadBundleOperation.cs
@@ -176,6 +176,12 @@ namespace YooAsset
if (_steps == ESteps.LoadBuildinRawBundle)
{
+#if UNITY_ANDROID
+ //TODO : 安卓平台内置文件属于APK压缩包内的文件。
+ _steps = ESteps.Done;
+ Result = new RawBundleResult(_fileSystem, _bundle);
+ Status = EOperationStatus.Succeed;
+#else
string filePath = _fileSystem.GetBuildinFileLoadPath(_bundle);
if (File.Exists(filePath))
{
@@ -190,6 +196,7 @@ namespace YooAsset
Error = $"Can not found buildin raw bundle file : {filePath}";
YooLogger.Error(Error);
}
+#endif
}
}
internal override void InternalWaitForAsyncComplete()
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
index 3490e52c..08ba4196 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinCatalogFileOperation.cs
@@ -1,4 +1,4 @@
-using UnityEngine;
+using System;
namespace YooAsset
{
@@ -7,56 +7,84 @@ namespace YooAsset
private enum ESteps
{
None,
+ RequestData,
LoadCatalog,
Done,
}
private readonly DefaultBuildinFileSystem _fileSystem;
+ private UnityWebDataRequestOperation _webDataRequestOp;
private ESteps _steps = ESteps.None;
-
internal LoadBuildinCatalogFileOperation(DefaultBuildinFileSystem fileSystem)
{
_fileSystem = fileSystem;
}
internal override void InternalStart()
{
- _steps = ESteps.LoadCatalog;
+ _steps = ESteps.RequestData;
}
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
+ if (_steps == ESteps.RequestData)
+ {
+ if (_webDataRequestOp == null)
+ {
+ string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
+ string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
+ _webDataRequestOp = new UnityWebDataRequestOperation(url);
+ _webDataRequestOp.StartOperation();
+ AddChildOperation(_webDataRequestOp);
+ }
+
+ _webDataRequestOp.UpdateOperation();
+ if (_webDataRequestOp.IsDone == false)
+ return;
+
+ if (_webDataRequestOp.Status == EOperationStatus.Succeed)
+ {
+ _steps = ESteps.LoadCatalog;
+ }
+ else
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = _webDataRequestOp.Error;
+ }
+ }
+
if (_steps == ESteps.LoadCatalog)
{
- string catalogFilePath = _fileSystem.GetCatalogFileLoadPath();
- var catalog = Resources.Load(catalogFilePath);
- if (catalog == null)
+ try
+ {
+ var catalog = CatalogTools.DeserializeFromBinary(_webDataRequestOp.Result);
+ if (catalog.PackageName != _fileSystem.PackageName)
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = $"Catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
+ return;
+ }
+
+ foreach (var wrapper in catalog.Wrappers)
+ {
+ var fileWrapper = new DefaultBuildinFileSystem.FileWrapper(wrapper.FileName);
+ _fileSystem.RecordCatalogFile(wrapper.BundleGUID, fileWrapper);
+ }
+
+ YooLogger.Log($"Package '{_fileSystem.PackageName}' buildin catalog files count : {catalog.Wrappers.Count}");
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Succeed;
+ }
+ catch (Exception e)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = $"Failed to load catalog file : {catalogFilePath}";
- return;
+ Error = $"Failed to load catalog file : {e.Message}";
}
-
- if (catalog.PackageName != _fileSystem.PackageName)
- {
- _steps = ESteps.Done;
- Status = EOperationStatus.Failed;
- Error = $"Catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
- return;
- }
-
- foreach (var wrapper in catalog.Wrappers)
- {
- var fileWrapper = new DefaultBuildinFileSystem.FileWrapper(wrapper.FileName);
- _fileSystem.RecordCatalogFile(wrapper.BundleGUID, fileWrapper);
- }
-
- YooLogger.Log($"Package '{_fileSystem.PackageName}' buildin catalog files count : {catalog.Wrappers.Count}");
- _steps = ESteps.Done;
- Status = EOperationStatus.Succeed;
}
}
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
index b9e747fc..ccc5c652 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultBuildinFileSystem/Operation/internal/LoadBuildinPackageManifestOperation.cs
@@ -69,8 +69,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- string fileHash = HashUtility.BytesCRC32(_webDataRequestOp.Result);
- if (fileHash == _packageHash)
+ if (ManifestTools.VerifyManifestData(_webDataRequestOp.Result, _packageHash))
{
_steps = ESteps.LoadManifest;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
index dee8068b..15d32796 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/DefaultCacheFileSystem.cs
@@ -65,6 +65,11 @@ namespace YooAsset
///
public EFileVerifyLevel FileVerifyLevel { private set; get; } = EFileVerifyLevel.Middle;
+ ///
+ /// 自定义参数:覆盖安装缓存清理模式
+ ///
+ public EOverwriteInstallClearMode InstallClearMode { private set; get; } = EOverwriteInstallClearMode.ClearAllManifestFiles;
+
///
/// 自定义参数:数据文件追加文件格式
///
@@ -115,43 +120,43 @@ namespace YooAsset
var operation = new DCFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
{
- if (clearMode == EFileClearMode.ClearAllBundleFiles.ToString())
+ if (options.ClearMode == EFileClearMode.ClearAllBundleFiles.ToString())
{
var operation = new ClearAllCacheBundleFilesOperation(this);
return operation;
}
- else if (clearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
+ else if (options.ClearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
{
var operation = new ClearUnusedCacheBundleFilesOperation(this, manifest);
return operation;
}
- else if (clearMode == EFileClearMode.ClearBundleFilesByTags.ToString())
+ else if (options.ClearMode == EFileClearMode.ClearBundleFilesByTags.ToString())
{
- var operation = new ClearCacheBundleFilesByTagsOperaiton(this, manifest, clearParam);
+ var operation = new ClearCacheBundleFilesByTagsOperaiton(this, manifest, options.ClearParam);
return operation;
}
- else if (clearMode == EFileClearMode.ClearAllManifestFiles.ToString())
+ else if (options.ClearMode == EFileClearMode.ClearAllManifestFiles.ToString())
{
var operation = new ClearAllCacheManifestFilesOperation(this);
return operation;
}
- else if (clearMode == EFileClearMode.ClearUnusedManifestFiles.ToString())
+ else if (options.ClearMode == EFileClearMode.ClearUnusedManifestFiles.ToString())
{
var operation = new ClearUnusedCacheManifestFilesOperation(this, manifest);
return operation;
}
else
{
- string error = $"Invalid clear mode : {clearMode}";
+ string error = $"Invalid clear mode : {options.ClearMode}";
var operation = new FSClearCacheFilesCompleteOperation(error);
return operation;
}
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
+ public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
- var downloader = DownloadCenter.DownloadFileAsync(bundle, param);
+ var downloader = DownloadCenter.DownloadFileAsync(bundle, options);
downloader.Reference(); //增加下载器的引用计数
// 注意:将下载器进行包裹,可以避免父类任务终止的时候,连带子任务里的下载器也一起被终止!
@@ -188,21 +193,25 @@ namespace YooAsset
{
FileVerifyLevel = (EFileVerifyLevel)value;
}
+ else if (name == FileSystemParametersDefine.INSTALL_CLEAR_MODE)
+ {
+ InstallClearMode = (EOverwriteInstallClearMode)value;
+ }
else if (name == FileSystemParametersDefine.APPEND_FILE_EXTENSION)
{
- AppendFileExtension = (bool)value;
+ AppendFileExtension = Convert.ToBoolean(value);
}
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_CONCURRENCY)
{
- DownloadMaxConcurrency = (int)value;
+ DownloadMaxConcurrency = Convert.ToInt32(value);
}
else if (name == FileSystemParametersDefine.DOWNLOAD_MAX_REQUEST_PER_FRAME)
{
- DownloadMaxRequestPerFrame = (int)value;
+ DownloadMaxRequestPerFrame = Convert.ToInt32(value);
}
else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_MINMUM_SIZE)
{
- ResumeDownloadMinimumSize = (long)value;
+ ResumeDownloadMinimumSize = Convert.ToInt64(value);
}
else if (name == FileSystemParametersDefine.RESUME_DOWNLOAD_RESPONSE_CODES)
{
@@ -227,8 +236,8 @@ namespace YooAsset
_packageRoot = packageRoot;
_cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.BundleFilesFolderName);
- _tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName);
_cacheManifestFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.ManifestFilesFolderName);
+ _tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultCacheFileSystemDefine.TempFilesFolderName);
}
public virtual void OnDestroy()
{
@@ -333,6 +342,13 @@ namespace YooAsset
{
return _records.Keys.ToList();
}
+ public RecordFileElement GetRecordFileElement(PackageBundle bundle)
+ {
+ if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element))
+ return element;
+ else
+ return null;
+ }
public string GetTempFilePath(PackageBundle bundle)
{
@@ -384,10 +400,10 @@ namespace YooAsset
public EFileVerifyResult VerifyCacheFile(PackageBundle bundle)
{
- if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement wrapper) == false)
+ if (_records.TryGetValue(bundle.BundleGUID, out RecordFileElement element) == false)
return EFileVerifyResult.CacheNotFound;
- EFileVerifyResult result = FileVerifyHelper.FileVerify(wrapper.DataFilePath, wrapper.DataFileSize, wrapper.DataFileCRC, EFileVerifyLevel.High);
+ EFileVerifyResult result = FileVerifyHelper.FileVerify(element.DataFilePath, element.DataFileSize, element.DataFileCRC, EFileVerifyLevel.High);
return result;
}
public bool WriteCacheBundleFile(PackageBundle bundle, string copyPath)
@@ -427,22 +443,10 @@ namespace YooAsset
}
public bool DeleteCacheBundleFile(string bundleGUID)
{
- if (_records.TryGetValue(bundleGUID, out RecordFileElement wrapper))
+ if (_records.TryGetValue(bundleGUID, out RecordFileElement element))
{
- try
- {
- string dataFilePath = wrapper.DataFilePath;
- FileInfo fileInfo = new FileInfo(dataFilePath);
- if (fileInfo.Exists)
- fileInfo.Directory.Delete(true);
- _records.Remove(bundleGUID);
- return true;
- }
- catch (Exception e)
- {
- YooLogger.Error($"Failed to delete cache file ! {e.Message}");
- return false;
- }
+ _records.Remove(bundleGUID);
+ return element.DeleteFolder();
}
else
{
@@ -505,7 +509,18 @@ namespace YooAsset
}
///
- /// 删除所有清单文件
+ /// 删除所有缓存的资源文件
+ ///
+ public void DeleteAllBundleFiles()
+ {
+ if (Directory.Exists(_cacheBundleFilesRoot))
+ {
+ Directory.Delete(_cacheBundleFilesRoot, true);
+ }
+ }
+
+ ///
+ /// 删除所有缓存的清单文件
///
public void DeleteAllManifestFiles()
{
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/EOverwriteInstallClearMode.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/EOverwriteInstallClearMode.cs
new file mode 100644
index 00000000..0a1c4032
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/EOverwriteInstallClearMode.cs
@@ -0,0 +1,29 @@
+
+namespace YooAsset
+{
+ ///
+ /// 覆盖安装清理模式
+ ///
+ public enum EOverwriteInstallClearMode
+ {
+ ///
+ /// 不做任何处理
+ ///
+ None = 0,
+
+ ///
+ /// 清理所有缓存文件(包含资源文件和清单文件)
+ ///
+ ClearAllCacheFiles = 1,
+
+ ///
+ /// 清理所有缓存的资源文件
+ ///
+ ClearAllBundleFiles = 2,
+
+ ///
+ /// 清理所有缓存的清单文件
+ ///
+ ClearAllManifestFiles = 3,
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/EOverwriteInstallClearMode.cs.meta b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/EOverwriteInstallClearMode.cs.meta
new file mode 100644
index 00000000..e7df2fd8
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/EOverwriteInstallClearMode.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: c61fdc079dca97548a0158b8100ec258
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Elements/RecordFileElement.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Elements/RecordFileElement.cs
index d44cbd41..6331b1e2 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Elements/RecordFileElement.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Elements/RecordFileElement.cs
@@ -1,4 +1,6 @@
-
+using System;
+using System.IO;
+
namespace YooAsset
{
internal class RecordFileElement
@@ -7,7 +9,7 @@ namespace YooAsset
public string DataFilePath { private set; get; }
public string DataFileCRC { private set; get; }
public long DataFileSize { private set; get; }
-
+
public RecordFileElement(string infoFilePath, string dataFilePath, string dataFileCRC, long dataFileSize)
{
InfoFilePath = infoFilePath;
@@ -15,5 +17,31 @@ namespace YooAsset
DataFileCRC = dataFileCRC;
DataFileSize = dataFileSize;
}
+
+ ///
+ /// 删除记录文件
+ ///
+ public bool DeleteFolder()
+ {
+ try
+ {
+ string directory = Path.GetDirectoryName(InfoFilePath);
+ DirectoryInfo directoryInfo = new DirectoryInfo(directory);
+ if (directoryInfo.Exists)
+ {
+ directoryInfo.Delete(true);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+ }
+ catch (Exception e)
+ {
+ YooLogger.Error($"Failed to delete cache file ! {e.Message}");
+ return false;
+ }
+ }
}
}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSInitializeOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSInitializeOperation.cs
index e8d27788..782c017a 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSInitializeOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSInitializeOperation.cs
@@ -46,9 +46,32 @@ namespace YooAsset
// 如果水印发生变化,则说明覆盖安装后首次打开游戏
if (appFootPrint.IsDirty())
{
- _fileSystem.DeleteAllManifestFiles();
+ if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.None)
+ {
+ YooLogger.Warning("Do nothing when overwrite install application !");
+ }
+ else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllCacheFiles)
+ {
+ _fileSystem.DeleteAllBundleFiles();
+ _fileSystem.DeleteAllManifestFiles();
+ YooLogger.Warning("Delete all cache files when overwrite install application !");
+ }
+ else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllBundleFiles)
+ {
+ _fileSystem.DeleteAllBundleFiles();
+ YooLogger.Warning("Delete all bundle files when overwrite install application !");
+ }
+ else if (_fileSystem.InstallClearMode == EOverwriteInstallClearMode.ClearAllManifestFiles)
+ {
+ _fileSystem.DeleteAllManifestFiles();
+ YooLogger.Warning("Delete all manifest files when overwrite install application !");
+ }
+ else
+ {
+ throw new System.NotImplementedException(_fileSystem.InstallClearMode.ToString());
+ }
+
appFootPrint.Coverage(_fileSystem.PackageName);
- YooLogger.Warning("Delete manifest files when application foot print dirty !");
}
_steps = ESteps.SearchCacheFiles;
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
index b588e0aa..2aefef9f 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/DCFSLoadBundleOperation.cs
@@ -1,4 +1,5 @@
-using System.IO;
+using System;
+using System.IO;
using UnityEngine;
namespace YooAsset
@@ -57,8 +58,8 @@ namespace YooAsset
// 注意:边玩边下下载器引用计数没有Release
if (_downloadFileOp == null)
{
- DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
- _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
+ DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
+ _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
_downloadFileOp.StartOperation();
AddChildOperation(_downloadFileOp);
}
@@ -260,9 +261,30 @@ namespace YooAsset
{
if (_fileSystem.Exists(_bundle))
{
- DownloadProgress = 1f;
- DownloadedBytes = _bundle.FileSize;
- _steps = ESteps.LoadCacheRawBundle;
+ // 注意:缓存的原生文件的格式,可能会在业务端根据需求发生变动!
+ // 注意:这里需要校验文件格式,如果不一致对本地文件进行修正!
+ string filePath = _fileSystem.GetCacheBundleFileLoadPath(_bundle);
+ if (File.Exists(filePath) == false)
+ {
+ try
+ {
+ var recordFileElement = _fileSystem.GetRecordFileElement(_bundle);
+ File.Move(recordFileElement.DataFilePath, filePath);
+ _steps = ESteps.LoadCacheRawBundle;
+ }
+ catch (Exception e)
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = $"Faild rename raw data file : {e.Message}";
+ }
+ }
+ else
+ {
+ DownloadProgress = 1f;
+ DownloadedBytes = _bundle.FileSize;
+ _steps = ESteps.LoadCacheRawBundle;
+ }
}
else
{
@@ -275,8 +297,8 @@ namespace YooAsset
// 注意:边玩边下下载器引用计数没有Release
if (_downloadFileOp == null)
{
- DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
- _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, downloadParam);
+ DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
+ _downloadFileOp = _fileSystem.DownloadFileAsync(_bundle, options);
_downloadFileOp.StartOperation();
AddChildOperation(_downloadFileOp);
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearCacheBundleFilesByTagsOperaiton.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearCacheBundleFilesByTagsOperaiton.cs
index b913af3c..eef4797a 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearCacheBundleFilesByTagsOperaiton.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearCacheBundleFilesByTagsOperaiton.cs
@@ -7,9 +7,10 @@ namespace YooAsset
private enum ESteps
{
None,
+ CheckManifest,
CheckArgs,
- GetTagsCacheFiles,
- ClearTagsCacheFiles,
+ GetClearCacheFiles,
+ ClearFilterCacheFiles,
Done,
}
@@ -29,13 +30,27 @@ namespace YooAsset
}
internal override void InternalStart()
{
- _steps = ESteps.CheckArgs;
+ _steps = ESteps.CheckManifest;
}
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
+ if (_steps == ESteps.CheckManifest)
+ {
+ if (_manifest == null)
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = "Can not found active package manifest !";
+ }
+ else
+ {
+ _steps = ESteps.CheckArgs;
+ }
+ }
+
if (_steps == ESteps.CheckArgs)
{
if (_clearParam == null)
@@ -67,17 +82,17 @@ namespace YooAsset
return;
}
- _steps = ESteps.GetTagsCacheFiles;
+ _steps = ESteps.GetClearCacheFiles;
}
- if (_steps == ESteps.GetTagsCacheFiles)
+ if (_steps == ESteps.GetClearCacheFiles)
{
- _clearBundleGUIDs = GetTagsBundleGUIDs();
+ _clearBundleGUIDs = GetBundleGUIDsByTag();
_clearFileTotalCount = _clearBundleGUIDs.Count;
- _steps = ESteps.ClearTagsCacheFiles;
+ _steps = ESteps.ClearFilterCacheFiles;
}
- if (_steps == ESteps.ClearTagsCacheFiles)
+ if (_steps == ESteps.ClearFilterCacheFiles)
{
for (int i = _clearBundleGUIDs.Count - 1; i >= 0; i--)
{
@@ -100,7 +115,7 @@ namespace YooAsset
}
}
}
- private List GetTagsBundleGUIDs()
+ private List GetBundleGUIDsByTag()
{
var allBundleGUIDs = _fileSystem.GetAllCachedBundleGUIDs();
List result = new List(allBundleGUIDs.Count);
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearUnusedCacheBundleFilesOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearUnusedCacheBundleFilesOperation.cs
index a09baf94..63841e14 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearUnusedCacheBundleFilesOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearUnusedCacheBundleFilesOperation.cs
@@ -8,6 +8,7 @@ namespace YooAsset
private enum ESteps
{
None,
+ CheckManifest,
GetUnusedCacheFiles,
ClearUnusedCacheFiles,
Done,
@@ -19,7 +20,7 @@ namespace YooAsset
private int _unusedFileTotalCount = 0;
private ESteps _steps = ESteps.None;
-
+
internal ClearUnusedCacheBundleFilesOperation(DefaultCacheFileSystem fileSystem, PackageManifest manifest)
{
_fileSystem = fileSystem;
@@ -27,15 +28,29 @@ namespace YooAsset
}
internal override void InternalStart()
{
- _steps = ESteps.GetUnusedCacheFiles;
+ _steps = ESteps.CheckManifest;
}
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
+ if (_steps == ESteps.CheckManifest)
+ {
+ if (_manifest == null)
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = "Can not found active package manifest !";
+ }
+ else
+ {
+ _steps = ESteps.GetUnusedCacheFiles;
+ }
+ }
+
if (_steps == ESteps.GetUnusedCacheFiles)
- {
+ {
_unusedBundleGUIDs = GetUnusedBundleGUIDs();
_unusedFileTotalCount = _unusedBundleGUIDs.Count;
_steps = ESteps.ClearUnusedCacheFiles;
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearUnusedCacheManifestFilesOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearUnusedCacheManifestFilesOperation.cs
index 90d6e22e..0de2013f 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearUnusedCacheManifestFilesOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/ClearUnusedCacheManifestFilesOperation.cs
@@ -8,6 +8,7 @@ namespace YooAsset
private enum ESteps
{
None,
+ CheckManifest,
ClearUnusedCacheFiles,
Done,
}
@@ -24,13 +25,27 @@ namespace YooAsset
}
internal override void InternalStart()
{
- _steps = ESteps.ClearUnusedCacheFiles;
+ _steps = ESteps.CheckManifest;
}
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
+ if (_steps == ESteps.CheckManifest)
+ {
+ if (_manifest == null)
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = "Can not found active package manifest !";
+ }
+ else
+ {
+ _steps = ESteps.ClearUnusedCacheFiles;
+ }
+ }
+
if (_steps == ESteps.ClearUnusedCacheFiles)
{
try
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs
index 09fa9514..047414f0 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadCenterOperation.cs
@@ -74,7 +74,7 @@ namespace YooAsset
///
/// 创建下载任务
///
- public FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
+ public FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
// 查询旧的下载器
if (_downloaders.TryGetValue(bundle.BundleGUID, out var oldDownloader))
@@ -83,29 +83,29 @@ namespace YooAsset
}
// 设置请求URL
- if (string.IsNullOrEmpty(param.ImportFilePath))
+ if (string.IsNullOrEmpty(options.ImportFilePath))
{
- param.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(bundle.FileName);
- param.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(bundle.FileName);
+ options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(bundle.FileName);
+ options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(bundle.FileName);
}
else
{
// 注意:把本地文件路径指定为远端下载地址
- param.MainURL = DownloadSystemHelper.ConvertToWWWPath(param.ImportFilePath);
- param.FallbackURL = param.MainURL;
+ options.MainURL = DownloadSystemHelper.ConvertToWWWPath(options.ImportFilePath);
+ options.FallbackURL = options.MainURL;
}
// 创建新的下载器
DefaultDownloadFileOperation newDownloader;
if (bundle.FileSize >= _fileSystem.ResumeDownloadMinimumSize)
{
- newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, param);
+ newDownloader = new DownloadResumeFileOperation(_fileSystem, bundle, options);
AddChildOperation(newDownloader);
_downloaders.Add(bundle.BundleGUID, newDownloader);
}
else
{
- newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, param);
+ newDownloader = new DownloadNormalFileOperation(_fileSystem, bundle, options);
AddChildOperation(newDownloader);
_downloaders.Add(bundle.BundleGUID, newDownloader);
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadNormalFileOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadNormalFileOperation.cs
index e50210ed..a4d6f77b 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadNormalFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadNormalFileOperation.cs
@@ -12,13 +12,13 @@ namespace YooAsset
private string _tempFilePath;
private ESteps _steps = ESteps.None;
- internal DownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal DownloadNormalFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
_fileSystem = fileSystem;
}
internal override void InternalStart()
{
- _isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL);
+ _isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Options.MainURL);
_tempFilePath = _fileSystem.GetTempFilePath(Bundle);
_steps = ESteps.CheckExists;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadResumeFileOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadResumeFileOperation.cs
index 9fab65dc..a96fc1a7 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadResumeFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/DownloadResumeFileOperation.cs
@@ -15,13 +15,13 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
- internal DownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal DownloadResumeFileOperation(DefaultCacheFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
_fileSystem = fileSystem;
}
internal override void InternalStart()
{
- _isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Param.MainURL);
+ _isReuqestLocalFile = DownloadSystemHelper.IsRequestLocalFile(Options.MainURL);
_tempFilePath = _fileSystem.GetTempFilePath(Bundle);
_steps = ESteps.CheckExists;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
index 96605fef..711f19cd 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/LoadCachePackageManifestOperation.cs
@@ -59,8 +59,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- string fileHash = HashUtility.BytesCRC32(_fileData);
- if (fileHash == _packageHash)
+ if (ManifestTools.VerifyManifestData(_fileData, _packageHash))
{
_steps = ESteps.LoadManifest;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/SearchCacheFilesOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/SearchCacheFilesOperation.cs
index 896b2280..0be6c4dc 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/SearchCacheFilesOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultCacheFileSystem/Operation/internal/SearchCacheFilesOperation.cs
@@ -85,15 +85,17 @@ namespace YooAsset
// 创建验证元素类
string fileRootPath = chidDirectory.FullName;
- string dataFilePath = $"{fileRootPath}/{ DefaultCacheFileSystemDefine.BundleDataFileName}";
- string infoFilePath = $"{fileRootPath}/{ DefaultCacheFileSystemDefine.BundleInfoFileName}";
+ string dataFilePath = $"{fileRootPath}/{DefaultCacheFileSystemDefine.BundleDataFileName}";
+ string infoFilePath = $"{fileRootPath}/{DefaultCacheFileSystemDefine.BundleInfoFileName}";
// 存储的数据文件追加文件格式
if (_fileSystem.AppendFileExtension)
{
string dataFileExtension = FindDataFileExtension(chidDirectory);
if (string.IsNullOrEmpty(dataFileExtension) == false)
+ {
dataFilePath += dataFileExtension;
+ }
}
var element = new VerifyFileElement(_fileSystem.PackageName, bundleGUID, fileRootPath, dataFilePath, infoFilePath);
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
index f867e723..b4108bc2 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/DefaultEditorFileSystem.cs
@@ -66,12 +66,12 @@ namespace YooAsset
var operation = new DEFSRequestPackageVersionOperation(this);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
{
var operation = new FSClearCacheFilesCompleteOperation();
return operation;
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
+ public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
throw new System.NotImplementedException();
}
@@ -94,11 +94,11 @@ namespace YooAsset
{
if (name == FileSystemParametersDefine.ASYNC_SIMULATE_MIN_FRAME)
{
- _asyncSimulateMinFrame = (int)value;
+ _asyncSimulateMinFrame = Convert.ToInt32(value);
}
else if (name == FileSystemParametersDefine.ASYNC_SIMULATE_MAX_FRAME)
{
- _asyncSimulateMaxFrame = (int)value;
+ _asyncSimulateMaxFrame = Convert.ToInt32(value);
}
else
{
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
index 33801580..cad37d04 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultEditorFileSystem/Operation/internal/LoadEditorPackageManifestOperation.cs
@@ -59,8 +59,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- string fileHash = HashUtility.BytesCRC32(_fileData);
- if (fileHash == _packageHash)
+ if (ManifestTools.VerifyManifestData(_fileData, _packageHash))
{
_steps = ESteps.LoadManifest;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystem.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystem.cs
index c45b5f26..3b56ac3a 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystem.cs
@@ -14,7 +14,8 @@ namespace YooAsset
base.OnCreate(packageName, rootDirectory);
// 注意:重写保存根目录和临时目录
- _cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.SaveFilesFolderName);
+ _cacheBundleFilesRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.SaveBundleFilesFolderName);
+ _cacheManifestFilesRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.SaveManifestFilesFolderName);
_tempFilesRoot = PathUtility.Combine(_packageRoot, DefaultUnpackFileSystemDefine.TempFilesFolderName);
}
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystemDefine.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystemDefine.cs
index 2cc50180..0eb7709d 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystemDefine.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultUnpackFileSystem/DefaultUnpackFileSystemDefine.cs
@@ -11,8 +11,13 @@ namespace YooAsset
///
/// 保存的资源文件的文件夹名称
///
- public const string SaveFilesFolderName = "UnpackFiles";
-
+ public const string SaveBundleFilesFolderName = "UnpackBundleFiles";
+
+ ///
+ /// 保存的清单文件的文件夹名称
+ ///
+ public const string SaveManifestFilesFolderName = "UnpackManifestFiles";
+
///
/// 下载的临时文件的文件夹名称
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/DefaultWebRemoteFileSystem.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/DefaultWebRemoteFileSystem.cs
index dca3fbd4..45c20696 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/DefaultWebRemoteFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/DefaultWebRemoteFileSystem.cs
@@ -73,12 +73,12 @@ namespace YooAsset
var operation = new DWRFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
{
var operation = new FSClearCacheFilesCompleteOperation();
return operation;
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
+ public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
throw new System.NotImplementedException();
}
@@ -101,7 +101,7 @@ namespace YooAsset
{
if (name == FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE)
{
- DisableUnityWebCache = (bool)value;
+ DisableUnityWebCache = Convert.ToBoolean(value);
}
else if (name == FileSystemParametersDefine.REMOTE_SERVICES)
{
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadBundleOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadBundleOperation.cs
index 8327dced..de18f0d2 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/DWRFSLoadBundleOperation.cs
@@ -34,19 +34,19 @@ namespace YooAsset
{
if (_downloadAssetBundleOp == null)
{
- DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
- downloadParam.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName);
- downloadParam.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
+ DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
+ options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName);
+ options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
if (_bundle.Encrypted)
{
- _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam);
+ _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, options);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
else
{
- _downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam);
+ _downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, options);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/internal/LoadWebRemotePackageManifestOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/internal/LoadWebRemotePackageManifestOperation.cs
index f204c7f4..13b2a653 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/internal/LoadWebRemotePackageManifestOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebRemoteFileSystem/Operation/internal/LoadWebRemotePackageManifestOperation.cs
@@ -72,8 +72,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- string fileHash = HashUtility.BytesCRC32(_webDataRequestOp.Result);
- if (fileHash == _packageHash)
+ if (ManifestTools.VerifyManifestData(_webDataRequestOp.Result, _packageHash))
{
_steps = ESteps.LoadManifest;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/DefaultWebServerFileSystem.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/DefaultWebServerFileSystem.cs
index 4a3cb528..a910c202 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/DefaultWebServerFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/DefaultWebServerFileSystem.cs
@@ -82,12 +82,12 @@ namespace YooAsset
var operation = new DWSFSRequestPackageVersionOperation(this, timeout);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
{
var operation = new FSClearCacheFilesCompleteOperation();
return operation;
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
+ public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
throw new System.NotImplementedException();
}
@@ -110,7 +110,7 @@ namespace YooAsset
{
if (name == FileSystemParametersDefine.DISABLE_UNITY_WEB_CACHE)
{
- DisableUnityWebCache = (bool)value;
+ DisableUnityWebCache = Convert.ToBoolean(value);
}
else if (name == FileSystemParametersDefine.DECRYPTION_SERVICES)
{
@@ -198,10 +198,9 @@ namespace YooAsset
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(PackageName, packageVersion);
return PathUtility.Combine(FileRoot, fileName);
}
- public string GetCatalogFileLoadPath()
+ public string GetCatalogBinaryFileLoadPath()
{
- string fileName = Path.GetFileNameWithoutExtension(DefaultBuildinFileSystemDefine.BuildinCatalogFileName);
- return YooAssetSettingsData.GetYooResourcesLoadPath(PackageName, fileName);
+ return PathUtility.Combine(_webPackageRoot, DefaultBuildinFileSystemDefine.BuildinCatalogBinaryFileName);
}
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadBundleOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadBundleOperation.cs
index dbe03643..120601b0 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/DWSFSLoadBundleOperation.cs
@@ -34,20 +34,20 @@ namespace YooAsset
{
if (_downloadAssetBundleOp == null)
{
- DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
+ DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
string fileLoadPath = _fileSystem.GetWebFileLoadPath(_bundle);
- downloadParam.MainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
- downloadParam.FallbackURL = downloadParam.MainURL;
+ options.MainURL = DownloadSystemHelper.ConvertToWWWPath(fileLoadPath);
+ options.FallbackURL = options.MainURL;
if (_bundle.Encrypted)
{
- _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, downloadParam);
+ _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(true, _fileSystem.DecryptionServices, _bundle, options);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
else
{
- _downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, downloadParam);
+ _downloadAssetBundleOp = new DownloadWebNormalAssetBundleOperation(_fileSystem.DisableUnityWebCache, _bundle, options);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
index 2b3b4f6b..d9aaeb64 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerCatalogFileOperation.cs
@@ -2,7 +2,6 @@
using System.IO;
using System.Collections;
using System.Collections.Generic;
-using UnityEngine;
namespace YooAsset
{
@@ -11,61 +10,84 @@ namespace YooAsset
private enum ESteps
{
None,
+ RequestData,
LoadCatalog,
Done,
}
private readonly DefaultWebServerFileSystem _fileSystem;
+ private UnityWebDataRequestOperation _webDataRequestOp;
private ESteps _steps = ESteps.None;
- ///
- /// 内置清单版本
- ///
- public string PackageVersion { private set; get; }
-
internal LoadWebServerCatalogFileOperation(DefaultWebServerFileSystem fileSystem)
{
_fileSystem = fileSystem;
}
internal override void InternalStart()
{
- _steps = ESteps.LoadCatalog;
+ _steps = ESteps.RequestData;
}
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
+ if (_steps == ESteps.RequestData)
+ {
+ if (_webDataRequestOp == null)
+ {
+ string filePath = _fileSystem.GetCatalogBinaryFileLoadPath();
+ string url = DownloadSystemHelper.ConvertToWWWPath(filePath);
+ _webDataRequestOp = new UnityWebDataRequestOperation(url);
+ _webDataRequestOp.StartOperation();
+ AddChildOperation(_webDataRequestOp);
+ }
+
+ _webDataRequestOp.UpdateOperation();
+ if (_webDataRequestOp.IsDone == false)
+ return;
+
+ if (_webDataRequestOp.Status == EOperationStatus.Succeed)
+ {
+ _steps = ESteps.LoadCatalog;
+ }
+ else
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = _webDataRequestOp.Error;
+ }
+ }
+
if (_steps == ESteps.LoadCatalog)
{
- string catalogFilePath = _fileSystem.GetCatalogFileLoadPath();
- var catalog = Resources.Load(catalogFilePath);
- if (catalog == null)
+ try
+ {
+ var catalog = CatalogTools.DeserializeFromBinary(_webDataRequestOp.Result);
+ if (catalog.PackageName != _fileSystem.PackageName)
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Failed;
+ Error = $"Catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
+ return;
+ }
+
+ foreach (var wrapper in catalog.Wrappers)
+ {
+ var fileWrapper = new DefaultWebServerFileSystem.FileWrapper(wrapper.FileName);
+ _fileSystem.RecordCatalogFile(wrapper.BundleGUID, fileWrapper);
+ }
+
+ YooLogger.Log($"Package '{_fileSystem.PackageName}' buildin catalog files count : {catalog.Wrappers.Count}");
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Succeed;
+ }
+ catch (Exception e)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = $"Failed to load web server catalog file : {catalogFilePath}";
- return;
+ Error = $"Failed to load catalog file : {e.Message}";
}
-
- if (catalog.PackageName != _fileSystem.PackageName)
- {
- _steps = ESteps.Done;
- Status = EOperationStatus.Failed;
- Error = $"Web server catalog file package name {catalog.PackageName} cannot match the file system package name {_fileSystem.PackageName}";
- return;
- }
-
- PackageVersion = catalog.PackageVersion;
- foreach (var wrapper in catalog.Wrappers)
- {
- var fileWrapper = new DefaultWebServerFileSystem.FileWrapper(wrapper.FileName);
- _fileSystem.RecordCatalogFile(wrapper.BundleGUID, fileWrapper);
- }
-
- YooLogger.Log($"Package '{_fileSystem.PackageName}' catalog files count : {catalog.Wrappers.Count}");
- _steps = ESteps.Done;
- Status = EOperationStatus.Succeed;
}
}
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
index 9d570998..e727b86a 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/DefaultWebServerFileSystem/Operation/internal/LoadWebServerPackageManifestOperation.cs
@@ -69,8 +69,7 @@ namespace YooAsset
if (_steps == ESteps.VerifyFileData)
{
- string fileHash = HashUtility.BytesCRC32(_webDataRequestOp.Result);
- if (fileHash == _packageHash)
+ if (ManifestTools.VerifyManifestData(_webDataRequestOp.Result, _packageHash))
{
_steps = ESteps.LoadManifest;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs
index ceff58f8..6c61693f 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/FileSystemParametersDefine.cs
@@ -4,6 +4,7 @@ namespace YooAsset
public class FileSystemParametersDefine
{
public const string FILE_VERIFY_LEVEL = "FILE_VERIFY_LEVEL";
+ 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 APPEND_FILE_EXTENSION = "APPEND_FILE_EXTENSION";
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
index 4a296f45..fb55c52c 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Interface/IFileSystem.cs
@@ -37,13 +37,13 @@ namespace YooAsset
///
/// 清理缓存文件
///
- FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam);
+ FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options);
///
/// 下载Bundle文件
///
- FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param);
-
+ FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options);
+
///
/// 加载Bundle文件
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/FSClearCacheFilesOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/FSClearCacheFilesOperation.cs
index 6c72accc..d78f4e46 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/FSClearCacheFilesOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/FSClearCacheFilesOperation.cs
@@ -1,6 +1,19 @@
namespace YooAsset
{
+ internal class ClearCacheFilesOptions
+ {
+ ///
+ /// 清理模式
+ ///
+ public string ClearMode;
+
+ ///
+ /// 附加参数
+ ///
+ public object ClearParam;
+ }
+
internal abstract class FSClearCacheFilesOperation : AsyncOperationBase
{
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
index b2165ef5..d9f1a170 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/FSDownloadFileOperation.cs
@@ -1,6 +1,40 @@
namespace YooAsset
{
+ internal class DownloadFileOptions
+ {
+ ///
+ /// 失败后重试次数
+ ///
+ public readonly int FailedTryAgain;
+
+ ///
+ /// 超时时间
+ ///
+ public readonly int Timeout;
+
+ ///
+ /// 主资源地址
+ ///
+ public string MainURL { set; get; }
+
+ ///
+ /// 备用资源地址
+ ///
+ public string FallbackURL { set; get; }
+
+ ///
+ /// 导入的本地文件路径
+ ///
+ public string ImportFilePath { set; get; }
+
+ public DownloadFileOptions(int failedTryAgain, int timeout)
+ {
+ FailedTryAgain = failedTryAgain;
+ Timeout = timeout;
+ }
+ }
+
internal abstract class FSDownloadFileOperation : AsyncOperationBase
{
public PackageBundle Bundle { private set; get; }
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultDownloadFileOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultDownloadFileOperation.cs
index e37d300b..60cc3b39 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultDownloadFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DefaultDownloadFileOperation.cs
@@ -18,7 +18,7 @@ namespace YooAsset
}
// 下载参数
- protected readonly DownloadParam Param;
+ protected readonly DownloadFileOptions Options;
// 请求相关
protected UnityWebRequest _webRequest;
@@ -35,10 +35,10 @@ namespace YooAsset
protected int FailedTryAgain;
- internal DefaultDownloadFileOperation(PackageBundle bundle, DownloadParam param) : base(bundle)
+ internal DefaultDownloadFileOperation(PackageBundle bundle, DownloadFileOptions options) : base(bundle)
{
- Param = param;
- FailedTryAgain = param.FailedTryAgain;
+ Options = options;
+ FailedTryAgain = options.FailedTryAgain;
}
///
@@ -49,9 +49,9 @@ namespace YooAsset
// 轮流返回请求地址
_requestCount++;
if (_requestCount % 2 == 0)
- return Param.FallbackURL;
+ return Options.FallbackURL;
else
- return Param.MainURL;
+ return Options.MainURL;
}
///
@@ -87,7 +87,7 @@ namespace YooAsset
}
float offset = UnityEngine.Time.realtimeSinceStartup - _latestDownloadRealtime;
- if (offset > Param.Timeout)
+ if (offset > Options.Timeout)
{
YooLogger.Warning($"Download request timeout : {_requestURL}");
if (_webRequest != null)
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs
index 8c261f79..29f28362 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadAssetBundleOperation.cs
@@ -4,7 +4,7 @@ namespace YooAsset
{
internal abstract class DownloadAssetBundleOperation : DefaultDownloadFileOperation
{
- internal DownloadAssetBundleOperation(PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal DownloadAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs
index 9424b3a2..8c0c43c3 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebEncryptAssetBundleOperation.cs
@@ -10,7 +10,7 @@ namespace YooAsset
private DownloadHandlerBuffer _downloadhandler;
private ESteps _steps = ESteps.None;
- internal DownloadWebEncryptAssetBundleOperation(bool checkTimeout, IWebDecryptionServices decryptionServices, PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal DownloadWebEncryptAssetBundleOperation(bool checkTimeout, IWebDecryptionServices decryptionServices, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
_checkTimeout = checkTimeout;
_decryptionServices = decryptionServices;
diff --git a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs
index 527999b9..b58bbca9 100644
--- a/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/FileSystem/Operation/Internal/DownloadWebNormalAssetBundleOperation.cs
@@ -9,7 +9,7 @@ namespace YooAsset
private DownloadHandlerAssetBundle _downloadhandler;
private ESteps _steps = ESteps.None;
- internal DownloadWebNormalAssetBundleOperation(bool disableUnityWebCache, PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal DownloadWebNormalAssetBundleOperation(bool disableUnityWebCache, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
_disableUnityWebCache = disableUnityWebCache;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/InitializeParameters.cs b/UnityProject/Packages/YooAsset/Runtime/InitializeParameters.cs
index bc36c30e..5818df7f 100644
--- a/UnityProject/Packages/YooAsset/Runtime/InitializeParameters.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/InitializeParameters.cs
@@ -38,6 +38,10 @@ namespace YooAsset
///
public abstract class InitializeParameters
{
+ ///
+ /// 同时加载Bundle文件的最大并发数
+ ///
+ public int BundleLoadingMaxConcurrency = int.MaxValue;
}
///
@@ -83,6 +87,6 @@ namespace YooAsset
/// 文件系统初始化参数列表
/// 注意:列表最后一个元素作为主文件系统!
///
- public List FileSystemParameterList;
+ public readonly List FileSystemParameterList = new List();
}
}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/OperationSystem/OperationSystem.cs b/UnityProject/Packages/YooAsset/Runtime/OperationSystem/OperationSystem.cs
index 74d5fe6b..75a22a21 100644
--- a/UnityProject/Packages/YooAsset/Runtime/OperationSystem/OperationSystem.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/OperationSystem/OperationSystem.cs
@@ -6,6 +6,14 @@ namespace YooAsset
{
internal class OperationSystem
{
+#if UNITY_EDITOR
+ [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ DestroyAll();
+ }
+#endif
+
private static readonly List _operations = new List(1000);
private static readonly List _newList = new List(1000);
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Handle/HandleFactory.cs b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Handle/HandleFactory.cs
new file mode 100644
index 00000000..c84d8d1b
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Handle/HandleFactory.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+
+namespace YooAsset
+{
+ internal static class HandleFactory
+ {
+ private static readonly Dictionary> _handleFactory = new Dictionary>()
+ {
+ { typeof(AssetHandle), op => new AssetHandle(op) },
+ { typeof(SceneHandle), op => new SceneHandle(op) },
+ { typeof(SubAssetsHandle), op => new SubAssetsHandle(op) },
+ { typeof(AllAssetsHandle), op => new AllAssetsHandle(op) },
+ { typeof(RawFileHandle), op => new RawFileHandle(op) }
+ };
+
+ public static HandleBase CreateHandle(ProviderOperation operation, Type type)
+ {
+ if (_handleFactory.TryGetValue(type, out var factory) == false)
+ {
+ throw new NotImplementedException($"Handle type {type.FullName} is not supported.");
+ }
+ return factory(operation);
+ }
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Handle/HandleFactory.cs.meta b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Handle/HandleFactory.cs.meta
new file mode 100644
index 00000000..1deec4f5
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Handle/HandleFactory.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 4d6ef91e069948c48b7ca60be4c218ee
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs
index e27a3ff1..d5837ade 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Operation/Internal/LoadBundleFileOperation.cs
@@ -9,7 +9,8 @@ namespace YooAsset
private enum ESteps
{
None,
- LoadFile,
+ CheckConcurrency,
+ LoadBundleFile,
Done,
}
@@ -57,17 +58,32 @@ namespace YooAsset
}
internal override void InternalStart()
{
- _steps = ESteps.LoadFile;
+ _steps = ESteps.CheckConcurrency;
}
internal override void InternalUpdate()
{
if (_steps == ESteps.None || _steps == ESteps.Done)
return;
- if (_steps == ESteps.LoadFile)
+ if (_steps == ESteps.CheckConcurrency)
+ {
+ if (IsWaitForAsyncComplete)
+ {
+ _steps = ESteps.LoadBundleFile;
+ }
+ else
+ {
+ if (_resourceManager.BundleLoadingIsBusy())
+ return;
+ _steps = ESteps.LoadBundleFile;
+ }
+ }
+
+ if (_steps == ESteps.LoadBundleFile)
{
if (_loadBundleOp == null)
{
+ _resourceManager.BundleLoadingCounter++;
_loadBundleOp = LoadBundleInfo.LoadBundleFile();
_loadBundleOp.StartOperation();
AddChildOperation(_loadBundleOp);
@@ -103,6 +119,9 @@ namespace YooAsset
Status = EOperationStatus.Failed;
Error = _loadBundleOp.Error;
}
+
+ // 统计计数减少
+ _resourceManager.BundleLoadingCounter--;
}
}
internal override void InternalWaitForAsyncComplete()
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOperation.cs b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOperation.cs
index 068905ea..ca4a13d9 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Operation/UnloadUnusedAssetsOperation.cs
@@ -15,6 +15,7 @@ namespace YooAsset
private readonly ResourceManager _resManager;
private readonly int _loopCount;
+ private int _loopCounter = 0;
private ESteps _steps = ESteps.None;
internal UnloadUnusedAssetsOperation(ResourceManager resourceManager, int loopCount)
@@ -25,6 +26,7 @@ namespace YooAsset
internal override void InternalStart()
{
_steps = ESteps.UnloadUnused;
+ _loopCounter = _loopCount;
}
internal override void InternalUpdate()
{
@@ -33,13 +35,23 @@ namespace YooAsset
if (_steps == ESteps.UnloadUnused)
{
- for (int i = 0; i < _loopCount; i++)
+ while (_loopCounter > 0)
{
+ _loopCounter--;
LoopUnloadUnused();
+
+ if (IsWaitForAsyncComplete == false)
+ {
+ if (OperationSystem.IsBusy)
+ break;
+ }
}
- _steps = ESteps.Done;
- Status = EOperationStatus.Succeed;
+ if (_loopCounter <= 0)
+ {
+ _steps = ESteps.Done;
+ Status = EOperationStatus.Succeed;
+ }
}
}
internal override void InternalWaitForAsyncComplete()
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Provider/ProviderOperation.cs b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Provider/ProviderOperation.cs
index e0cf31ef..ee81fb6f 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Provider/ProviderOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/Provider/ProviderOperation.cs
@@ -1,7 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
-using System;
+using System.Linq;
namespace YooAsset
{
@@ -69,8 +69,8 @@ namespace YooAsset
private ESteps _steps = ESteps.None;
private readonly LoadBundleFileOperation _mainBundleLoader;
- private readonly List _bundleLoaders = new List();
- private readonly List _handles = new List();
+ private readonly List _bundleLoaders = new List(10);
+ private readonly HashSet _handles = new HashSet();
public ProviderOperation(ResourceManager manager, string providerGUID, AssetInfo assetInfo)
@@ -220,20 +220,7 @@ namespace YooAsset
// 引用计数增加
RefCount++;
- HandleBase handle;
- if (typeof(T) == typeof(AssetHandle))
- handle = new AssetHandle(this);
- else if (typeof(T) == typeof(SceneHandle))
- handle = new SceneHandle(this);
- else if (typeof(T) == typeof(SubAssetsHandle))
- handle = new SubAssetsHandle(this);
- else if (typeof(T) == typeof(AllAssetsHandle))
- handle = new AllAssetsHandle(this);
- else if (typeof(T) == typeof(RawFileHandle))
- handle = new RawFileHandle(this);
- else
- throw new System.NotImplementedException();
-
+ HandleBase handle = HandleFactory.CreateHandle(this, typeof(T));
_handles.Add(handle);
return handle as T;
}
@@ -258,9 +245,9 @@ namespace YooAsset
///
public void ReleaseAllHandles()
{
- for (int i = _handles.Count - 1; i >= 0; i--)
+ List tempers = _handles.ToList();
+ foreach (var handle in tempers)
{
- var handle = _handles[i];
handle.Release();
}
}
@@ -276,7 +263,7 @@ namespace YooAsset
// 注意:创建临时列表是为了防止外部逻辑在回调函数内创建或者释放资源句柄。
// 注意:回调方法如果发生异常,会阻断列表里的后续回调方法!
- List tempers = new List(_handles);
+ List tempers = _handles.ToList();
foreach (var hande in tempers)
{
if (hande.IsValid)
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/ResourceManager.cs b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/ResourceManager.cs
index 03bf2a10..bf386dcd 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourceManager/ResourceManager.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourceManager/ResourceManager.cs
@@ -14,6 +14,7 @@ namespace YooAsset
internal readonly List SceneHandles = new List(100);
private long _sceneCreateIndex = 0;
private IBundleQuery _bundleQuery;
+ private int _bundleLoadingMaxConcurrency;
///
/// 所属包裹
@@ -25,6 +26,11 @@ namespace YooAsset
///
public bool LockLoadOperation = false;
+ ///
+ /// 统计正在加载的Bundle文件数量
+ ///
+ public int BundleLoadingCounter = 0;
+
public ResourceManager(string packageName)
{
@@ -34,8 +40,9 @@ namespace YooAsset
///
/// 初始化
///
- public void Initialize(IBundleQuery bundleServices)
+ public void Initialize(InitializeParameters parameters, IBundleQuery bundleServices)
{
+ _bundleLoadingMaxConcurrency = parameters.BundleLoadingMaxConcurrency;
_bundleQuery = bundleServices;
SceneManager.sceneUnloaded += OnSceneUnloaded;
}
@@ -310,6 +317,10 @@ namespace YooAsset
{
return LoaderDic.Count > 0;
}
+ internal bool BundleLoadingIsBusy()
+ {
+ return BundleLoadingCounter >= _bundleLoadingMaxConcurrency;
+ }
private LoadBundleFileOperation CreateBundleFileLoaderInternal(BundleInfo bundleInfo)
{
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/AssetInfo.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/AssetInfo.cs
index d5cdb1af..6ff83be6 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/AssetInfo.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/AssetInfo.cs
@@ -3,6 +3,16 @@ namespace YooAsset
{
public class AssetInfo
{
+ internal enum ELoadMethod
+ {
+ None = 0,
+ LoadAsset,
+ LoadSubAssets,
+ LoadAllAssets,
+ LoadScene,
+ LoadRawFile,
+ }
+
private readonly PackageAsset _packageAsset;
private string _providerGUID;
@@ -21,6 +31,11 @@ namespace YooAsset
///
public string Error { private set; get; }
+ ///
+ /// 加载方法
+ ///
+ internal ELoadMethod LoadMethod;
+
///
/// 资源对象
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/BundleInfo.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
index b6bd1aff..09a6db29 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/BundleInfo.cs
@@ -38,9 +38,9 @@ namespace YooAsset
///
public FSDownloadFileOperation CreateDownloader(int failedTryAgain, int timeout)
{
- DownloadParam downloadParam = new DownloadParam(failedTryAgain, timeout);
- downloadParam.ImportFilePath = _importFilePath;
- return _fileSystem.DownloadFileAsync(Bundle, downloadParam);
+ DownloadFileOptions options = new DownloadFileOptions(failedTryAgain, timeout);
+ options.ImportFilePath = _importFilePath;
+ return _fileSystem.DownloadFileAsync(Bundle, options);
}
///
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/EFileNameStyle.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/EFileNameStyle.cs
similarity index 79%
rename from UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/EFileNameStyle.cs
rename to UnityProject/Packages/YooAsset/Runtime/ResourcePackage/EFileNameStyle.cs
index b6bac711..4e1fd0c9 100644
--- a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/EFileNameStyle.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/EFileNameStyle.cs
@@ -1,9 +1,6 @@
-namespace YooAsset.Editor
+namespace YooAsset
{
- ///
- /// 补丁包内的文件样式
- ///
public enum EFileNameStyle
{
///
diff --git a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/EFileNameStyle.cs.meta b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/EFileNameStyle.cs.meta
similarity index 83%
rename from UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/EFileNameStyle.cs.meta
rename to UnityProject/Packages/YooAsset/Runtime/ResourcePackage/EFileNameStyle.cs.meta
index 856af36e..4b353f4e 100644
--- a/UnityProject/Packages/YooAsset/Editor/AssetBundleBuilder/EFileNameStyle.cs.meta
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/EFileNameStyle.cs.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: 84c5eff5dedf53343897e83f6b10eea6
+guid: 5e81f00e510f07947873055518f5d1c6
MonoImporter:
externalObjects: {}
serializedVersion: 2
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs
index d4b45496..e859ae5e 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Interface/IPlayMode.cs
@@ -31,8 +31,8 @@ namespace YooAsset
///
/// 清理缓存文件
///
- ClearCacheFilesOperation ClearCacheFilesAsync(string clearMode, object clearParam);
-
+ ClearCacheFilesOperation ClearCacheFilesAsync(ClearCacheFilesOptions options);
+
// 下载相关
ResourceDownloaderOperation CreateResourceDownloaderByAll(int downloadingMaxNumber, int failedTryAgain, int timeout);
ResourceDownloaderOperation CreateResourceDownloaderByTags(string[] tags, int downloadingMaxNumber, int failedTryAgain, int timeout);
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs
new file mode 100644
index 00000000..f37396ac
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs
@@ -0,0 +1,21 @@
+
+namespace YooAsset
+{
+ public class ManifestDefine
+ {
+ ///
+ /// 文件极限大小(100MB)
+ ///
+ public const int FileMaxSize = 104857600;
+
+ ///
+ /// 文件头标记
+ ///
+ public const uint FileSign = 0x594F4F;
+
+ ///
+ /// 文件格式版本
+ ///
+ public const string FileVersion = "2.3.1";
+ }
+}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs.meta b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs.meta
new file mode 100644
index 00000000..956b8c0e
--- /dev/null
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestDefine.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 3282b72521a19144292a482e50ba0429
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestTools.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestTools.cs
index cfe87568..2890aea6 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestTools.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ManifestTools.cs
@@ -8,7 +8,30 @@ namespace YooAsset
{
internal static class ManifestTools
{
-#if UNITY_EDITOR
+ ///
+ /// 验证清单文件的二进制数据
+ ///
+ public static bool VerifyManifestData(byte[] fileData, string hashValue)
+ {
+ if (fileData == null || fileData.Length == 0)
+ return false;
+ if (string.IsNullOrEmpty(hashValue))
+ return false;
+
+ // 注意:兼容俩种验证方式
+ // 注意:计算MD5的哈希值通常为32个字符
+ string fileHash;
+ if (hashValue.Length == 32)
+ fileHash = HashUtility.BytesMD5(fileData);
+ else
+ fileHash = HashUtility.BytesCRC32(fileData);
+
+ if (fileHash == hashValue)
+ return true;
+ else
+ return false;
+ }
+
///
/// 序列化(JSON文件)
///
@@ -26,10 +49,10 @@ namespace YooAsset
using (FileStream fs = new FileStream(savePath, FileMode.Create))
{
// 创建缓存器
- BufferWriter buffer = new BufferWriter(YooAssetSettings.ManifestFileMaxSize);
+ BufferWriter buffer = new BufferWriter(ManifestDefine.FileMaxSize);
// 写入文件标记
- buffer.WriteUInt32(YooAssetSettings.ManifestFileSign);
+ buffer.WriteUInt32(ManifestDefine.FileSign);
// 写入文件版本
buffer.WriteUTF8(manifest.FileVersion);
@@ -97,13 +120,13 @@ namespace YooAsset
// 读取文件标记
uint fileSign = buffer.ReadUInt32();
- if (fileSign != YooAssetSettings.ManifestFileSign)
+ if (fileSign != ManifestDefine.FileSign)
throw new Exception("Invalid manifest file !");
// 读取文件版本
string fileVersion = buffer.ReadUTF8();
- if (fileVersion != YooAssetSettings.ManifestFileVersion)
- throw new Exception($"The manifest file version are not compatible : {fileVersion} != {YooAssetSettings.ManifestFileVersion}");
+ if (fileVersion != ManifestDefine.FileVersion)
+ throw new Exception($"The manifest file version are not compatible : {fileVersion} != {ManifestDefine.FileVersion}");
PackageManifest manifest = new PackageManifest();
{
@@ -160,7 +183,7 @@ namespace YooAsset
InitManifest(manifest);
return manifest;
}
-#endif
+
#region 解析资源清单辅助方法
public static void InitManifest(PackageManifest manifest)
@@ -198,9 +221,16 @@ namespace YooAsset
manifest.AssetDic = new Dictionary(assetCount);
if (manifest.EnableAddressable)
+ {
manifest.AssetPathMapping1 = new Dictionary(assetCount * 3);
+ }
else
- manifest.AssetPathMapping1 = new Dictionary(assetCount * 2);
+ {
+ if (manifest.LocationToLower)
+ manifest.AssetPathMapping1 = new Dictionary(assetCount * 2, StringComparer.OrdinalIgnoreCase);
+ else
+ manifest.AssetPathMapping1 = new Dictionary(assetCount * 2);
+ }
if (manifest.IncludeAssetGUID)
manifest.AssetPathMapping2 = new Dictionary(assetCount);
@@ -222,8 +252,6 @@ namespace YooAsset
// 填充AssetPathMapping1
{
string location = packageAsset.AssetPath;
- if (manifest.LocationToLower)
- location = location.ToLower();
// 添加原生路径的映射
if (manifest.AssetPathMapping1.ContainsKey(location))
@@ -286,27 +314,6 @@ namespace YooAsset
}
#endregion
- ///
- /// 注意:该类拷贝自编辑器
- ///
- private enum EFileNameStyle
- {
- ///
- /// 哈希值名称
- ///
- HashName = 0,
-
- ///
- /// 资源包名称(不推荐)
- ///
- BundleName = 1,
-
- ///
- /// 资源包名称 + 哈希值名称
- ///
- BundleName_HashName = 2,
- }
-
///
/// 获取资源文件的后缀名
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOperation.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOperation.cs
index 5c4baf04..abcd0b9e 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Operation/ClearCacheFilesOperation.cs
@@ -15,17 +15,15 @@ namespace YooAsset
}
private readonly PlayModeImpl _impl;
- private readonly string _clearMode;
- private readonly object _clearParam;
+ private readonly ClearCacheFilesOptions _options;
private List _cloneList;
private FSClearCacheFilesOperation _clearCacheFilesOp;
private ESteps _steps = ESteps.None;
- internal ClearCacheFilesOperation(PlayModeImpl impl, string clearMode, object clearParam)
+ internal ClearCacheFilesOperation(PlayModeImpl impl, ClearCacheFilesOptions options)
{
_impl = impl;
- _clearMode = clearMode;
- _clearParam = clearParam;
+ _options = options;
}
internal override void InternalStart()
{
@@ -74,7 +72,7 @@ namespace YooAsset
var fileSystem = _cloneList[0];
_cloneList.RemoveAt(0);
- _clearCacheFilesOp = fileSystem.ClearCacheFilesAsync(_impl.ActiveManifest, _clearMode, _clearParam);
+ _clearCacheFilesOp = fileSystem.ClearCacheFilesAsync(_impl.ActiveManifest, _options);
_clearCacheFilesOp.StartOperation();
AddChildOperation(_clearCacheFilesOp);
_steps = ESteps.CheckClearResult;
@@ -102,7 +100,7 @@ namespace YooAsset
}
internal override string InternalGetDesc()
{
- return $"ClearMode : {_clearMode}";
+ return $"ClearMode : {_options.ClearMode}";
}
}
}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Operation/Internal/DeserializeManifestOperation.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Operation/Internal/DeserializeManifestOperation.cs
index 4e4b8d34..824854a2 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Operation/Internal/DeserializeManifestOperation.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/Operation/Internal/DeserializeManifestOperation.cs
@@ -57,7 +57,7 @@ namespace YooAsset
// 读取文件标记
uint fileSign = _buffer.ReadUInt32();
- if (fileSign != YooAssetSettings.ManifestFileSign)
+ if (fileSign != ManifestDefine.FileSign)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
@@ -67,11 +67,11 @@ namespace YooAsset
// 读取文件版本
string fileVersion = _buffer.ReadUTF8();
- if (fileVersion != YooAssetSettings.ManifestFileVersion)
+ if (fileVersion != ManifestDefine.FileVersion)
{
_steps = ESteps.Done;
Status = EOperationStatus.Failed;
- Error = $"The manifest file version are not compatible : {fileVersion} != {YooAssetSettings.ManifestFileVersion}";
+ Error = $"The manifest file version are not compatible : {fileVersion} != {ManifestDefine.FileVersion}";
return;
}
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/PackageManifest.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/PackageManifest.cs
index 66454833..8942a865 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/PackageManifest.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/PackageManifest.cs
@@ -138,9 +138,6 @@ namespace YooAsset
if (string.IsNullOrEmpty(location))
return string.Empty;
- if (LocationToLower)
- location = location.ToLower();
-
if (AssetPathMapping1.TryGetValue(location, out string assetPath))
return assetPath;
else
@@ -174,7 +171,7 @@ namespace YooAsset
}
///
- /// 获取资源依赖列表
+ /// 获取依赖列表
/// 注意:传入的资源对象一定合法有效!
///
public PackageBundle[] GetAllDependencies(PackageAsset packageAsset)
@@ -188,6 +185,21 @@ namespace YooAsset
return result.ToArray();
}
+ ///
+ /// 获取依赖列表
+ /// 注意:传入的资源包对象一定合法有效!
+ ///
+ public PackageBundle[] GetAllDependencies(PackageBundle packageBundle)
+ {
+ List result = new List(packageBundle.DependBundleIDs.Length);
+ foreach (var dependID in packageBundle.DependBundleIDs)
+ {
+ var dependBundle = GetMainPackageBundle(dependID);
+ result.Add(dependBundle);
+ }
+ return result.ToArray();
+ }
+
///
/// 尝试获取包裹的资源
///
@@ -292,9 +304,6 @@ namespace YooAsset
return string.Empty;
}
- if (LocationToLower)
- location = location.ToLower();
-
if (AssetPathMapping1.TryGetValue(location, out string assetPath))
{
return assetPath;
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs
index b0c306a8..15c91f0b 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/PlayMode/PlayModeImpl.cs
@@ -97,9 +97,9 @@ namespace YooAsset
///
/// 清理缓存文件
///
- ClearCacheFilesOperation IPlayMode.ClearCacheFilesAsync(string clearMode, object clearParam)
+ ClearCacheFilesOperation IPlayMode.ClearCacheFilesAsync(ClearCacheFilesOptions options)
{
- var operation = new ClearCacheFilesOperation(this, clearMode, clearParam);
+ var operation = new ClearCacheFilesOperation(this, options);
return operation;
}
@@ -176,7 +176,17 @@ namespace YooAsset
throw new Exception("Should never get here !");
// 注意:如果清单里未找到资源包会抛出异常!
- var depends = ActiveManifest.GetAllDependencies(assetInfo.Asset);
+ PackageBundle[] depends;
+ if (assetInfo.LoadMethod == AssetInfo.ELoadMethod.LoadAllAssets)
+ {
+ var mainBundle = ActiveManifest.GetMainPackageBundle(assetInfo.Asset);
+ depends = ActiveManifest.GetAllDependencies(mainBundle);
+ }
+ else
+ {
+ depends = ActiveManifest.GetAllDependencies(assetInfo.Asset);
+ }
+
List result = new List(depends.Length);
foreach (var packageBundle in depends)
{
diff --git a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
index d38d7274..055a5e6c 100644
--- a/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/ResourcePackage/ResourcePackage.cs
@@ -100,7 +100,7 @@ namespace YooAsset
var playModeImpl = new PlayModeImpl(PackageName, _playMode);
_bundleQuery = playModeImpl;
_playModeImpl = playModeImpl;
- _resourceManager.Initialize(_bundleQuery);
+ _resourceManager.Initialize(parameters, _bundleQuery);
// 初始化资源系统
InitializationOperation initializeOperation;
@@ -162,6 +162,10 @@ namespace YooAsset
throw new Exception($"Editor simulate mode only support unity editor.");
#endif
+ // 检测初始化参数
+ if (parameters.BundleLoadingMaxConcurrency <= 0)
+ throw new Exception($"{nameof(parameters.BundleLoadingMaxConcurrency)} value must be greater than zero.");
+
// 鉴定运行模式
if (parameters is EditorSimulateModeParameters)
_playMode = EPlayMode.EditorSimulateMode;
@@ -263,8 +267,11 @@ namespace YooAsset
/// 执行参数
public ClearCacheFilesOperation ClearCacheFilesAsync(EFileClearMode clearMode, object clearParam = null)
{
- DebugCheckInitialize();
- var operation = _playModeImpl.ClearCacheFilesAsync(clearMode.ToString(), clearParam);
+ DebugCheckInitialize(false);
+ ClearCacheFilesOptions options = new ClearCacheFilesOptions();
+ options.ClearMode = clearMode.ToString();
+ options.ClearParam = clearParam;
+ var operation = _playModeImpl.ClearCacheFilesAsync(options);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
@@ -276,8 +283,11 @@ namespace YooAsset
/// 执行参数
public ClearCacheFilesOperation ClearCacheFilesAsync(string clearMode, object clearParam = null)
{
- DebugCheckInitialize();
- var operation = _playModeImpl.ClearCacheFilesAsync(clearMode, clearParam);
+ DebugCheckInitialize(false);
+ ClearCacheFilesOptions options = new ClearCacheFilesOptions();
+ options.ClearMode = clearMode;
+ options.ClearParam = clearParam;
+ var operation = _playModeImpl.ClearCacheFilesAsync(options);
OperationSystem.StartOperation(PackageName, operation);
return operation;
}
@@ -610,6 +620,7 @@ namespace YooAsset
private SceneHandle LoadSceneInternal(AssetInfo assetInfo, bool waitForAsyncComplete, LoadSceneMode sceneMode, LocalPhysicsMode physicsMode, bool suspendLoad, uint priority)
{
DebugCheckAssetLoadType(assetInfo.AssetType);
+ assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadScene;
var loadSceneParams = new LoadSceneParameters(sceneMode, physicsMode);
var handle = _resourceManager.LoadSceneAsync(assetInfo, loadSceneParams, suspendLoad, priority);
if (waitForAsyncComplete)
@@ -720,6 +731,7 @@ namespace YooAsset
private AssetHandle LoadAssetInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
{
DebugCheckAssetLoadType(assetInfo.AssetType);
+ assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadAsset;
var handle = _resourceManager.LoadAssetAsync(assetInfo, priority);
if (waitForAsyncComplete)
handle.WaitForAsyncComplete();
@@ -829,6 +841,7 @@ namespace YooAsset
private SubAssetsHandle LoadSubAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
{
DebugCheckAssetLoadType(assetInfo.AssetType);
+ assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadSubAssets;
var handle = _resourceManager.LoadSubAssetsAsync(assetInfo, priority);
if (waitForAsyncComplete)
handle.WaitForAsyncComplete();
@@ -938,6 +951,7 @@ namespace YooAsset
private AllAssetsHandle LoadAllAssetsInternal(AssetInfo assetInfo, bool waitForAsyncComplete, uint priority)
{
DebugCheckAssetLoadType(assetInfo.AssetType);
+ assetInfo.LoadMethod = AssetInfo.ELoadMethod.LoadAllAssets;
var handle = _resourceManager.LoadAllAssetsAsync(assetInfo, priority);
if (waitForAsyncComplete)
handle.WaitForAsyncComplete();
diff --git a/UnityProject/Packages/YooAsset/Runtime/Settings/YooAssetSettings.cs b/UnityProject/Packages/YooAsset/Runtime/Settings/YooAssetSettings.cs
index 0fb841e7..3562a812 100644
--- a/UnityProject/Packages/YooAsset/Runtime/Settings/YooAssetSettings.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/Settings/YooAssetSettings.cs
@@ -16,22 +16,6 @@ namespace YooAsset
public string PackageManifestPrefix = string.Empty;
- ///
- /// 清单文件头标记
- ///
- public const uint ManifestFileSign = 0x594F4F;
-
- ///
- /// 清单文件极限大小(100MB)
- ///
- public const int ManifestFileMaxSize = 104857600;
-
- ///
- /// 清单文件格式版本
- ///
- public const string ManifestFileVersion = "2.3.1";
-
-
///
/// 构建输出文件夹名称
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/Settings/YooAssetSettingsData.cs b/UnityProject/Packages/YooAsset/Runtime/Settings/YooAssetSettingsData.cs
index 13ce8b80..e67f2c47 100644
--- a/UnityProject/Packages/YooAsset/Runtime/Settings/YooAssetSettingsData.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/Settings/YooAssetSettingsData.cs
@@ -5,6 +5,14 @@ namespace YooAsset
{
public static class YooAssetSettingsData
{
+#if UNITY_EDITOR
+ [UnityEngine.RuntimeInitializeOnLoadMethod(UnityEngine.RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ _setting = null;
+ }
+#endif
+
private static YooAssetSettings _setting = null;
internal static YooAssetSettings Setting
{
@@ -98,28 +106,6 @@ namespace YooAsset
}
#region 路径相关
- ///
- /// 获取YOO的Resources目录的加载路径
- ///
- internal static string GetYooResourcesLoadPath(string packageName, string fileName)
- {
- if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
- return PathUtility.Combine(packageName, fileName);
- else
- return PathUtility.Combine(Setting.DefaultYooFolderName, packageName, fileName);
- }
-
- ///
- /// 获取YOO的Resources目录的全路径
- ///
- internal static string GetYooResourcesFullPath()
- {
- if (string.IsNullOrEmpty(Setting.DefaultYooFolderName))
- return $"Assets/Resources";
- else
- return $"Assets/Resources/{Setting.DefaultYooFolderName}";
- }
-
///
/// 获取YOO的编辑器下缓存文件根目录
///
diff --git a/UnityProject/Packages/YooAsset/Runtime/YooAsset.asmdef b/UnityProject/Packages/YooAsset/Runtime/YooAsset.asmdef
index e61c9d1b..8f1c3e77 100644
--- a/UnityProject/Packages/YooAsset/Runtime/YooAsset.asmdef
+++ b/UnityProject/Packages/YooAsset/Runtime/YooAsset.asmdef
@@ -9,6 +9,22 @@
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
- "versionDefines": [],
+ "versionDefines": [
+ {
+ "name": "com.tuyoogame.yooasset",
+ "expression": "",
+ "define": "YOO_ASSET_2"
+ },
+ {
+ "name": "com.tuyoogame.yooasset",
+ "expression": "2.3",
+ "define": "YOO_ASSET_2_3"
+ },
+ {
+ "name": "com.tuyoogame.yooasset",
+ "expression": "2.3",
+ "define": "YOO_ASSET_2_3_OR_NEWER"
+ }
+ ],
"noEngineReferences": false
}
\ No newline at end of file
diff --git a/UnityProject/Packages/YooAsset/Runtime/YooAssets.cs b/UnityProject/Packages/YooAsset/Runtime/YooAssets.cs
index 6e7c9b8b..5dc8a2a6 100644
--- a/UnityProject/Packages/YooAsset/Runtime/YooAssets.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/YooAssets.cs
@@ -2,12 +2,23 @@ using System;
using System.Diagnostics;
using System.Collections;
using System.Collections.Generic;
+using System.Linq;
using UnityEngine;
namespace YooAsset
{
public static partial class YooAssets
{
+#if UNITY_EDITOR
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ _isInitialize = false;
+ _packages.Clear();
+ _defaultPackage = null;
+ }
+#endif
+
private static bool _isInitialize = false;
private static GameObject _driver = null;
private static readonly List _packages = new List();
@@ -77,9 +88,9 @@ namespace YooAsset
}
///
- /// 创建资源包
+ /// 创建资源包裹
///
- /// 资源包名称
+ /// 包裹名称
public static ResourcePackage CreatePackage(string packageName)
{
CheckException(packageName);
@@ -93,9 +104,9 @@ namespace YooAsset
}
///
- /// 获取资源包
+ /// 获取资源包裹
///
- /// 资源包名称
+ /// 包裹名称
public static ResourcePackage GetPackage(string packageName)
{
CheckException(packageName);
@@ -106,9 +117,9 @@ namespace YooAsset
}
///
- /// 尝试获取资源包
+ /// 尝试获取资源包裹
///
- /// 资源包名称
+ /// 包裹名称
public static ResourcePackage TryGetPackage(string packageName)
{
CheckException(packageName);
@@ -116,9 +127,17 @@ namespace YooAsset
}
///
- /// 移除资源包
+ /// 获取所有资源包裹
///
- /// 资源包名称
+ public static List GetAllPackages()
+ {
+ return _packages.ToList();
+ }
+
+ ///
+ /// 移除资源包裹
+ ///
+ /// 包裹名称
public static bool RemovePackage(string packageName)
{
CheckException(packageName);
@@ -130,9 +149,9 @@ namespace YooAsset
}
///
- /// 移除资源包
+ /// 移除资源包裹
///
- /// 资源包实例对象
+ /// 包裹实例对象
public static bool RemovePackage(ResourcePackage package)
{
CheckException(package);
@@ -149,9 +168,9 @@ namespace YooAsset
}
///
- /// 检测资源包是否存在
+ /// 检测资源包裹是否存在
///
- /// 资源包名称
+ /// 包裹名称
public static bool ContainsPackage(string packageName)
{
CheckException(packageName);
diff --git a/UnityProject/Packages/YooAsset/Runtime/YooAssetsDriver.cs b/UnityProject/Packages/YooAsset/Runtime/YooAssetsDriver.cs
index 176104f8..d576bfcb 100644
--- a/UnityProject/Packages/YooAsset/Runtime/YooAssetsDriver.cs
+++ b/UnityProject/Packages/YooAsset/Runtime/YooAssetsDriver.cs
@@ -5,6 +5,14 @@ namespace YooAsset
{
internal class YooAssetsDriver : MonoBehaviour
{
+#if UNITY_EDITOR
+ [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
+ private static void OnRuntimeInitialize()
+ {
+ LastestUpdateFrame = 0;
+ }
+#endif
+
private static int LastestUpdateFrame = 0;
void Update()
diff --git a/UnityProject/Packages/YooAsset/Extension.meta b/UnityProject/Packages/YooAsset/RuntimeExtension.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionClass.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionClass.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionClass/AssetHandleExtension.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass/AssetHandleExtension.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionClass/AssetHandleExtension.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass/AssetHandleExtension.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionClass/AssetHandleExtension.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass/AssetHandleExtension.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionClass/AssetHandleExtension.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass/AssetHandleExtension.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionClass/HandleBaseExtension.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass/HandleBaseExtension.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionClass/HandleBaseExtension.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass/HandleBaseExtension.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionClass/HandleBaseExtension.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass/HandleBaseExtension.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionClass/HandleBaseExtension.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionClass/HandleBaseExtension.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/BundleResult.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/BundleResult.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/BundleResult.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/BundleResult.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs
similarity index 93%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs
index c67f4957..f30ac53e 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs
@@ -23,7 +23,10 @@ namespace YooAsset
{
if (_assetBundle != null)
{
- _assetBundle.TTUnload(true);
+ if (_packageBundle.Encrypted)
+ _assetBundle.Unload(true);
+ else
+ _assetBundle.TTUnload(true);
}
}
public override string GetBundleFilePath()
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/BundleResult/TTAssetBundleResult.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs
similarity index 97%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs
index 3ee15b0d..d79c8903 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs
@@ -8,7 +8,7 @@ internal class TTFSDownloadFileOperation : DefaultDownloadFileOperation
private TiktokFileSystem _fileSystem;
private ESteps _steps = ESteps.None;
- internal TTFSDownloadFileOperation(TiktokFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal TTFSDownloadFileOperation(TiktokFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
_fileSystem = fileSystem;
}
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSDownloadFileOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSInitializeOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSInitializeOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSInitializeOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSInitializeOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSInitializeOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSInitializeOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSInitializeOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSInitializeOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs
similarity index 89%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs
index 1b1887e4..a7e8773c 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs
@@ -35,19 +35,19 @@ internal class TTFSLoadBundleOperation : FSLoadBundleOperation
{
if (_downloadAssetBundleOp == null)
{
- DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
- downloadParam.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName); ;
- downloadParam.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
+ DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
+ options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName); ;
+ options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
if (_bundle.Encrypted)
{
- _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, downloadParam);
+ _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, options);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
else
{
- _downloadAssetBundleOp = new DownloadTiktokAssetBundleOperation(_bundle, downloadParam);
+ _downloadAssetBundleOp = new DownloadTiktokAssetBundleOperation(_bundle, options);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadBundleOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadPackageManifestOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadPackageManifestOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadPackageManifestOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadPackageManifestOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadPackageManifestOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadPackageManifestOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadPackageManifestOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSLoadPackageManifestOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSRequestPackageVersionOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSRequestPackageVersionOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSRequestPackageVersionOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSRequestPackageVersionOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSRequestPackageVersionOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSRequestPackageVersionOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSRequestPackageVersionOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/TTFSRequestPackageVersionOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs
similarity index 98%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs
index ffb8364e..d3f23268 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs
@@ -8,7 +8,7 @@ namespace YooAsset
{
private ESteps _steps = ESteps.None;
- internal DownloadTiktokAssetBundleOperation(PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal DownloadTiktokAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
}
internal override void InternalStart()
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/DownloadTiktokAssetBundleOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/LoadTiktokPackageManifestOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/LoadTiktokPackageManifestOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/LoadTiktokPackageManifestOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/LoadTiktokPackageManifestOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/LoadTiktokPackageManifestOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/LoadTiktokPackageManifestOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/LoadTiktokPackageManifestOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/LoadTiktokPackageManifestOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageHashOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageHashOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageHashOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageHashOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageHashOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageHashOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageHashOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageHashOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageVersionOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageVersionOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageVersionOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageVersionOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageVersionOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageVersionOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageVersionOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/Operation/internal/RequestTiktokPackageVersionOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs
similarity index 96%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs
index 00f0debf..ab13aec0 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs
@@ -124,16 +124,16 @@ internal class TiktokFileSystem : IFileSystem
var operation = new TTFSRequestPackageVersionOperation(this, timeout);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
{
var operation = new FSClearCacheFilesCompleteOperation();
return operation;
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
+ public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
- param.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
- param.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
- var operation = new TTFSDownloadFileOperation(this, bundle, param);
+ options.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
+ options.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
+ var operation = new TTFSDownloadFileOperation(this, bundle, options);
return operation;
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/TiktokFileSystem/TiktokFileSystem.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/BundleResult.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/BundleResult.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/BundleResult.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/BundleResult.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs
similarity index 93%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs
index 3d6d6528..80510bdc 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs
@@ -11,7 +11,7 @@ namespace YooAsset
private readonly IFileSystem _fileSystem;
private readonly PackageBundle _packageBundle;
private readonly AssetBundle _assetBundle;
-
+
public WXAssetBundleResult(IFileSystem fileSystem, PackageBundle packageBundle, AssetBundle assetBundle)
{
_fileSystem = fileSystem;
@@ -23,7 +23,10 @@ namespace YooAsset
{
if (_assetBundle != null)
{
- _assetBundle.WXUnload(true);
+ if (_packageBundle.Encrypted)
+ _assetBundle.Unload(true);
+ else
+ _assetBundle.WXUnload(true);
}
}
public override string GetBundleFilePath()
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/BundleResult/WXAssetBundleResult.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearAllBundleFilesOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearAllBundleFilesOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearAllBundleFilesOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearAllBundleFilesOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearAllBundleFilesOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearAllBundleFilesOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearAllBundleFilesOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearAllBundleFilesOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs
similarity index 72%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs
index 368fb7e8..c54e1d43 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs
@@ -1,6 +1,7 @@
#if UNITY_WEBGL && WEIXINMINIGAME
using System.Collections.Generic;
using System.IO;
+using System.Linq;
using YooAsset;
using WeChatWASM;
@@ -17,7 +18,7 @@ internal class WXFSClearUnusedBundleFilesAsync : FSClearCacheFilesOperation
private readonly WechatFileSystem _fileSystem;
private readonly PackageManifest _manifest;
- private List _unusedCacheFiles;
+ private List _unusedCacheFiles = new List(1000);
private int _unusedFileTotalCount = 0;
private ESteps _steps = ESteps.None;
@@ -39,6 +40,7 @@ internal class WXFSClearUnusedBundleFilesAsync : FSClearCacheFilesOperation
{
_steps = ESteps.WaitingSearch;
+ // 说明:__GAME_FILE_CACHE/yoo/ 目录下包含所有的资源文件和清单文件
var fileSystemMgr = _fileSystem.GetFileSystemMgr();
var statOption = new WXStatOption();
statOption.path = _fileSystem.FileRoot;
@@ -47,13 +49,24 @@ internal class WXFSClearUnusedBundleFilesAsync : FSClearCacheFilesOperation
{
foreach (var fileStat in response.stats)
{
- // 注意:存储文件必须按照Bundle文件哈希值存储!
- string bundleGUID = Path.GetFileNameWithoutExtension(fileStat.path);
+ // 如果是目录文件
+ string fileExtension = Path.GetExtension(fileStat.path);
+ if (string.IsNullOrEmpty(fileExtension))
+ continue;
+
+ // 如果是资源清单
+ //TODO 默认的清单文件格式
+ if (fileExtension == ".bytes" || fileExtension == ".hash")
+ continue;
+
+ // 注意:适配不同的文件命名方式!
+ string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fileStat.path);
+ string bundleGUID = fileNameWithoutExtension.Split('_').Last();
if (_manifest.TryGetPackageBundleByBundleGUID(bundleGUID, out PackageBundle value) == false)
{
- string fullPath = WX.GetCachePath(fileStat.path);
- if (_unusedCacheFiles.Contains(fullPath) == false)
- _unusedCacheFiles.Add(fullPath);
+ string filePath = _fileSystem.FileRoot + fileStat.path;
+ if (_unusedCacheFiles.Contains(filePath) == false)
+ _unusedCacheFiles.Add(filePath);
}
}
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSClearUnusedBundleFilesAsync.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs
similarity index 97%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs
index dc631ec6..c9c8ede7 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs
@@ -9,7 +9,7 @@ internal class WXFSDownloadFileOperation : DefaultDownloadFileOperation
private WechatFileSystem _fileSystem;
private ESteps _steps = ESteps.None;
- internal WXFSDownloadFileOperation(WechatFileSystem fileSystem, PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal WXFSDownloadFileOperation(WechatFileSystem fileSystem, PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
_fileSystem = fileSystem;
}
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSDownloadFileOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSInitializeOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSInitializeOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSInitializeOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSInitializeOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSInitializeOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSInitializeOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSInitializeOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSInitializeOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs
similarity index 89%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs
index fe17c9b4..e0ce2a7c 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs
@@ -33,19 +33,19 @@ internal class WXFSLoadBundleOperation : FSLoadBundleOperation
{
if (_downloadAssetBundleOp == null)
{
- DownloadParam downloadParam = new DownloadParam(int.MaxValue, 60);
- downloadParam.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName); ;
- downloadParam.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
+ DownloadFileOptions options = new DownloadFileOptions(int.MaxValue, 60);
+ options.MainURL = _fileSystem.RemoteServices.GetRemoteMainURL(_bundle.FileName); ;
+ options.FallbackURL = _fileSystem.RemoteServices.GetRemoteFallbackURL(_bundle.FileName);
if (_bundle.Encrypted)
{
- _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, downloadParam);
+ _downloadAssetBundleOp = new DownloadWebEncryptAssetBundleOperation(false, _fileSystem.DecryptionServices, _bundle, options);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
else
{
- _downloadAssetBundleOp = new DownloadWechatAssetBundleOperation(_bundle, downloadParam);
+ _downloadAssetBundleOp = new DownloadWechatAssetBundleOperation(_bundle, options);
_downloadAssetBundleOp.StartOperation();
AddChildOperation(_downloadAssetBundleOp);
}
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadBundleOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadPackageManifestOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadPackageManifestOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadPackageManifestOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadPackageManifestOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadPackageManifestOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadPackageManifestOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadPackageManifestOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSLoadPackageManifestOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSRequestPackageVersionOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSRequestPackageVersionOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSRequestPackageVersionOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSRequestPackageVersionOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSRequestPackageVersionOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSRequestPackageVersionOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSRequestPackageVersionOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/WXFSRequestPackageVersionOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs
similarity index 98%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs
index f7212a17..ae9393d2 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs
@@ -8,7 +8,7 @@ namespace YooAsset
{
private ESteps _steps = ESteps.None;
- internal DownloadWechatAssetBundleOperation(PackageBundle bundle, DownloadParam param) : base(bundle, param)
+ internal DownloadWechatAssetBundleOperation(PackageBundle bundle, DownloadFileOptions options) : base(bundle, options)
{
}
internal override void InternalStart()
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/DownloadWechatAssetBundleOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/LoadWechatPackageManifestOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/LoadWechatPackageManifestOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/LoadWechatPackageManifestOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/LoadWechatPackageManifestOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/LoadWechatPackageManifestOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/LoadWechatPackageManifestOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/LoadWechatPackageManifestOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/LoadWechatPackageManifestOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageHashOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageHashOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageHashOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageHashOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageHashOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageHashOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageHashOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageHashOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageVersionOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageVersionOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageVersionOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageVersionOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageVersionOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageVersionOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageVersionOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/Operation/internal/RequestWechatPackageVersionOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
similarity index 92%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
index 0f4c7340..c789081a 100644
--- a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs
@@ -3,11 +3,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
-using UnityEngine.Scripting;
using YooAsset;
using WeChatWASM;
-[Preserve]
public static class WechatFileSystemCreater
{
public static FileSystemParameters CreateFileSystemParameters(string packageRoot, IRemoteServices remoteServices)
@@ -31,7 +29,6 @@ public static class WechatFileSystemCreater
/// 微信小游戏文件系统
/// 参考:https://wechat-miniprogram.github.io/minigame-unity-webgl-transform/Design/UsingAssetBundle.html
///
-[Preserve]
internal class WechatFileSystem : IFileSystem
{
private class WebRemoteServices : IRemoteServices
@@ -128,30 +125,30 @@ internal class WechatFileSystem : IFileSystem
var operation = new WXFSRequestPackageVersionOperation(this, appendTimeTicks, timeout);
return operation;
}
- public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, string clearMode, object clearParam)
+ public virtual FSClearCacheFilesOperation ClearCacheFilesAsync(PackageManifest manifest, ClearCacheFilesOptions options)
{
- if (clearMode == EFileClearMode.ClearAllBundleFiles.ToString())
+ if (options.ClearMode == EFileClearMode.ClearAllBundleFiles.ToString())
{
var operation = new WXFSClearAllBundleFilesOperation(this);
return operation;
}
- else if (clearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
+ else if (options.ClearMode == EFileClearMode.ClearUnusedBundleFiles.ToString())
{
var operation = new WXFSClearUnusedBundleFilesAsync(this, manifest);
return operation;
}
else
{
- string error = $"Invalid clear mode : {clearMode}";
+ string error = $"Invalid clear mode : {options.ClearMode}";
var operation = new FSClearCacheFilesCompleteOperation(error);
return operation;
}
}
- public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadParam param)
+ public virtual FSDownloadFileOperation DownloadFileAsync(PackageBundle bundle, DownloadFileOptions options)
{
- param.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
- param.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
- var operation = new WXFSDownloadFileOperation(this, bundle, param);
+ options.MainURL = RemoteServices.GetRemoteMainURL(bundle.FileName);
+ options.FallbackURL = RemoteServices.GetRemoteFallbackURL(bundle.FileName);
+ var operation = new WXFSDownloadFileOperation(this, bundle, options);
return operation;
}
public virtual FSLoadBundleOperation LoadBundleFile(PackageBundle bundle)
@@ -194,11 +191,6 @@ internal class WechatFileSystem : IFileSystem
throw new System.Exception("请配置微信小游戏缓存根目录!");
}
- if (_wxCacheRoot.StartsWith(WX.PluginCachePath) == false)
- {
- _wxCacheRoot = PathUtility.Combine(WX.PluginCachePath, _wxCacheRoot);
- }
-
// 注意:CDN服务未启用的情况下,使用微信WEB服务器
if (RemoteServices == null)
{
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionFileSystem/WechatFileSystem/WechatFileSystem.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation/CopyBuildinManifestOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/CopyBuildinManifestOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation/CopyBuildinManifestOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/CopyBuildinManifestOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation/CopyBuildinManifestOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/CopyBuildinManifestOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation/CopyBuildinManifestOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/CopyBuildinManifestOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation/GetCacheBundleSizeOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/GetCacheBundleSizeOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation/GetCacheBundleSizeOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/GetCacheBundleSizeOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation/GetCacheBundleSizeOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/GetCacheBundleSizeOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation/GetCacheBundleSizeOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/GetCacheBundleSizeOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation/LoadAssetsByTagOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/LoadAssetsByTagOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation/LoadAssetsByTagOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/LoadAssetsByTagOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation/LoadAssetsByTagOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/LoadAssetsByTagOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation/LoadAssetsByTagOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/LoadAssetsByTagOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation/LoadGameObjectOperation.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/LoadGameObjectOperation.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation/LoadGameObjectOperation.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/LoadGameObjectOperation.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/ExtensionOperation/LoadGameObjectOperation.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/LoadGameObjectOperation.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/ExtensionOperation/LoadGameObjectOperation.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/ExtensionOperation/LoadGameObjectOperation.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/GameObjectAssetReference.cs b/UnityProject/Packages/YooAsset/RuntimeExtension/GameObjectAssetReference.cs
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/GameObjectAssetReference.cs
rename to UnityProject/Packages/YooAsset/RuntimeExtension/GameObjectAssetReference.cs
diff --git a/UnityProject/Packages/YooAsset/Extension/GameObjectAssetReference.cs.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/GameObjectAssetReference.cs.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/GameObjectAssetReference.cs.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/GameObjectAssetReference.cs.meta
diff --git a/UnityProject/Packages/YooAsset/Extension/YooAsset.RuntimeExtension.asmdef b/UnityProject/Packages/YooAsset/RuntimeExtension/YooAsset.RuntimeExtension.asmdef
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/YooAsset.RuntimeExtension.asmdef
rename to UnityProject/Packages/YooAsset/RuntimeExtension/YooAsset.RuntimeExtension.asmdef
diff --git a/UnityProject/Packages/YooAsset/Extension/YooAsset.RuntimeExtension.asmdef.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/YooAsset.RuntimeExtension.asmdef.meta
similarity index 76%
rename from UnityProject/Packages/YooAsset/Extension/YooAsset.RuntimeExtension.asmdef.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/YooAsset.RuntimeExtension.asmdef.meta
index f209cd91..3348f8e8 100644
--- a/UnityProject/Packages/YooAsset/Extension/YooAsset.RuntimeExtension.asmdef.meta
+++ b/UnityProject/Packages/YooAsset/RuntimeExtension/YooAsset.RuntimeExtension.asmdef.meta
@@ -1,5 +1,5 @@
fileFormatVersion: 2
-guid: d7fc4d49301802c4d997d63a24928ab3
+guid: 3fe1a3e70da50184f9897101cad7e4f2
AssemblyDefinitionImporter:
externalObjects: {}
userData:
diff --git a/UnityProject/Packages/YooAsset/Extension/link.xml b/UnityProject/Packages/YooAsset/RuntimeExtension/link.xml
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/link.xml
rename to UnityProject/Packages/YooAsset/RuntimeExtension/link.xml
diff --git a/UnityProject/Packages/YooAsset/Extension/link.xml.meta b/UnityProject/Packages/YooAsset/RuntimeExtension/link.xml.meta
similarity index 100%
rename from UnityProject/Packages/YooAsset/Extension/link.xml.meta
rename to UnityProject/Packages/YooAsset/RuntimeExtension/link.xml.meta
diff --git a/UnityProject/Packages/YooAsset/package.json b/UnityProject/Packages/YooAsset/package.json
index e4cccb2b..83b903f1 100644
--- a/UnityProject/Packages/YooAsset/package.json
+++ b/UnityProject/Packages/YooAsset/package.json
@@ -1,7 +1,7 @@
{
"name": "com.tuyoogame.yooasset",
"displayName": "YooAsset",
- "version": "2.3.3-preview",
+ "version": "2.3.7",
"unity": "2019.4",
"description": "unity3d resources management system.",
"author": {