From 91fe51d10a8233349042fb52e1c4c67dbf37882a Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 22 Mar 2023 18:48:52 +0800 Subject: [PATCH] update patch system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit UpdatePackageManifestOperation增加新方法FlushManifestVersionFile() --- .../Operations/UpdatePackageManifestOperation.cs | 9 +++++++++ .../PatchSystem/PlayMode/EditorSimulateModeImpl.cs | 3 +-- .../PatchSystem/PlayMode/HostPlayModeImpl.cs | 13 +++++++++---- .../PatchSystem/PlayMode/OfflinePlayModeImpl.cs | 3 +-- .../Runtime/Services/Internal/IPlayModeServices.cs | 6 +++--- 5 files changed, 23 insertions(+), 11 deletions(-) diff --git a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageManifestOperation.cs b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageManifestOperation.cs index 8e6d061..ac79014 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageManifestOperation.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/Operations/UpdatePackageManifestOperation.cs @@ -9,6 +9,10 @@ namespace YooAsset /// public abstract class UpdatePackageManifestOperation : AsyncOperationBase { + /// + /// 保存清单版本文件到沙盒 + /// + public virtual void FlushManifestVersionFile() { } } /// @@ -173,5 +177,10 @@ namespace YooAsset } } } + + public override void FlushManifestVersionFile() + { + _impl.FlushManifestVersionFile(); + } } } \ No newline at end of file diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs index 7ad2489..e2f52f5 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/EditorSimulateModeImpl.cs @@ -33,9 +33,8 @@ namespace YooAsset return _activeManifest; } } - public bool IsBuildinPackageBundle(PackageBundle packageBundle) + public void FlushManifestVersionFile() { - return true; } UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout) diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs index 025edf1..290c10f 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/HostPlayModeImpl.cs @@ -84,22 +84,27 @@ namespace YooAsset { _activeManifest = value; _activeManifest.InitAssetPathMapping(_locationToLower); - PersistentHelper.SaveCachePackageVersionFile(_packageName, _activeManifest.PackageVersion); } get { return _activeManifest; } } - public bool IsBuildinPackageBundle(PackageBundle packageBundle) + public void FlushManifestVersionFile() + { + if (_activeManifest != null) + PersistentHelper.SaveCachePackageVersionFile(_packageName, _activeManifest.PackageVersion); + } + + private bool IsBuildinPackageBundle(PackageBundle packageBundle) { return _queryServices.QueryStreamingAssets(packageBundle.FileName); } - public bool IsCachedPackageBundle(PackageBundle packageBundle) + private bool IsCachedPackageBundle(PackageBundle packageBundle) { return CacheSystem.IsCached(packageBundle.PackageName, packageBundle.CacheGUID); } - + UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout) { var operation = new HostPlayModeUpdatePackageVersionOperation(this, _packageName, appendTimeTicks, timeout); diff --git a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs index 37617aa..a99439d 100644 --- a/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs +++ b/Assets/YooAsset/Runtime/PatchSystem/PlayMode/OfflinePlayModeImpl.cs @@ -33,9 +33,8 @@ namespace YooAsset return _activeManifest; } } - public bool IsBuildinPackageBundle(PackageBundle packageBundle) + public void FlushManifestVersionFile() { - return true; } UpdatePackageVersionOperation IPlayModeServices.UpdatePackageVersionAsync(bool appendTimeTicks, int timeout) diff --git a/Assets/YooAsset/Runtime/Services/Internal/IPlayModeServices.cs b/Assets/YooAsset/Runtime/Services/Internal/IPlayModeServices.cs index 0c8a5fb..834e0bc 100644 --- a/Assets/YooAsset/Runtime/Services/Internal/IPlayModeServices.cs +++ b/Assets/YooAsset/Runtime/Services/Internal/IPlayModeServices.cs @@ -7,11 +7,11 @@ namespace YooAsset /// 激活的清单 /// PackageManifest ActiveManifest { set; get; } - + /// - /// 是否为内置资源文件 + /// 保存清单版本文件到沙盒 /// - bool IsBuildinPackageBundle(PackageBundle packageBundle); + void FlushManifestVersionFile(); /// /// 向网络端请求最新的资源版本