From 2204f4d12987dbcb52b330e963279e083a294d1e Mon Sep 17 00:00:00 2001 From: hevinci Date: Sun, 31 Jul 2022 23:09:54 +0800 Subject: [PATCH] Update PatchManifest MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 资源补丁清单增加文件版本信息 --- .../BuildTasks/TaskCreatePatchManifest.cs | 1 + Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs | 9 +++++++++ Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs | 7 ++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs index 5944376..194ee24 100644 --- a/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs +++ b/Assets/YooAsset/Editor/AssetBundleBuilder/BuildTasks/TaskCreatePatchManifest.cs @@ -28,6 +28,7 @@ namespace YooAsset.Editor // 创建新补丁清单 PatchManifest patchManifest = new PatchManifest(); + patchManifest.FileVersion = YooAssetSettings.PatchManifestFileVersion; patchManifest.ResourceVersion = buildParameters.Parameters.BuildVersion; patchManifest.EnableAddressable = buildParameters.Parameters.EnableAddressable; patchManifest.OutputNameStyle = (int)buildParameters.Parameters.OutputNameStyle; diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs index b638d7e..ea18152 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs @@ -12,6 +12,11 @@ namespace YooAsset [Serializable] internal class PatchManifest { + /// + /// 文件版本 + /// + public string FileVersion; + /// /// 资源版本号 /// @@ -229,6 +234,10 @@ namespace YooAsset { PatchManifest patchManifest = JsonUtility.FromJson(jsonData); + // 检测文件版本 + if (patchManifest.FileVersion != YooAssetSettings.PatchManifestFileVersion) + throw new Exception($"The manifest file version are not compatible : {patchManifest.FileVersion} != {YooAssetSettings.PatchManifestFileVersion}"); + // BundleList foreach (var patchBundle in patchManifest.BundleList) { diff --git a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs index 89ad779..d3828a7 100644 --- a/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs +++ b/Assets/YooAsset/Runtime/Settings/YooAssetSettings.cs @@ -16,11 +16,16 @@ namespace YooAsset public string RawFileVariant = "rawfile"; /// - /// 构建输出的补丁清单文件名称 + /// 补丁清单文件名称 /// public string PatchManifestFileName = "PatchManifest"; + /// + /// 补丁清单文件版本 + /// + public const string PatchManifestFileVersion = "1.2.2"; + /// /// 构建输出文件夹名称 ///