From c14db5fd0d6fd831c88ce19d6486d0b7eac2fb05 Mon Sep 17 00:00:00 2001 From: hevinci Date: Mon, 17 Oct 2022 16:04:47 +0800 Subject: [PATCH] Update PatchSystem MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加AssetsPackage.GetHumanReadableVersion()方法 --- Assets/YooAsset/Runtime/AssetsPackage.cs | 24 +++++++++++++++++++ .../Runtime/PatchSystem/PatchManifest.cs | 5 ++++ .../PlayMode/EditorSimulateModeImpl.cs | 10 ++++++++ .../PatchSystem/PlayMode/HostPlayModeImpl.cs | 10 ++++++++ .../PlayMode/OfflinePlayModeImpl.cs | 10 ++++++++ 5 files changed, 59 insertions(+) diff --git a/Assets/YooAsset/Runtime/AssetsPackage.cs b/Assets/YooAsset/Runtime/AssetsPackage.cs index 53d6658..94567ee 100644 --- a/Assets/YooAsset/Runtime/AssetsPackage.cs +++ b/Assets/YooAsset/Runtime/AssetsPackage.cs @@ -277,6 +277,30 @@ namespace YooAsset } } + /// + /// 获取人类可读的版本信息 + /// + public string GetHumanReadableVersion() + { + DebugCheckInitialize(); + if (_playMode == EPlayMode.EditorSimulateMode) + { + return _editorSimulateModeImpl.GetHumanReadableVersion(); + } + else if (_playMode == EPlayMode.OfflinePlayMode) + { + return _offlinePlayModeImpl.GetHumanReadableVersion(); + } + else if (_playMode == EPlayMode.HostPlayMode) + { + return _hostPlayModeImpl.GetHumanReadableVersion(); + } + else + { + throw new NotImplementedException(); + } + } + /// /// 资源回收(卸载引用计数为零的资源) /// diff --git a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs index 840e404..fe6e4d6 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PatchManifest.cs @@ -32,6 +32,11 @@ namespace YooAsset /// public string PackageName; + /// + /// 人类可读的版本信息 + /// + public string HumanReadableVersion; + /// /// 资源列表(主动收集的资源列表) /// diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs index 3d5969d..88296fa 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs @@ -20,6 +20,16 @@ namespace YooAsset return operation; } + /// + /// 获取人类可读的版本信息 + /// + public string GetHumanReadableVersion() + { + if (_simulatePatchManifest == null) + return string.Empty; + return _simulatePatchManifest.HumanReadableVersion; + } + // 设置资源清单 internal void SetSimulatePatchManifest(PatchManifest patchManifest) { diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs index a9a0008..5264993 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs @@ -31,6 +31,16 @@ namespace YooAsset return operation; } + /// + /// 获取人类可读的版本信息 + /// + public string GetHumanReadableVersion() + { + if (LocalPatchManifest == null) + return string.Empty; + return LocalPatchManifest.HumanReadableVersion; + } + /// /// 异步更新资源版本号 /// diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs index 847766e..2c2fda6 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs @@ -20,6 +20,16 @@ namespace YooAsset return operation; } + /// + /// 获取人类可读的版本信息 + /// + public string GetHumanReadableVersion() + { + if (_appPatchManifest == null) + return string.Empty; + return _appPatchManifest.HumanReadableVersion; + } + // 设置资源清单 internal void SetAppPatchManifest(PatchManifest patchManifest) {