From b5df53939236bd153e8ab6f77be5f5eface2bb6d Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 19 Jul 2023 15:57:34 +0800 Subject: [PATCH] update package system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加对UpdatePackageManifestOperation参数的检测 --- .../Internal/DownloadManifestOperation.cs | 2 +- .../UpdatePackageManifestOperation.cs | 48 ++++++++++++++++++- 2 files changed, 47 insertions(+), 3 deletions(-) diff --git a/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DownloadManifestOperation.cs b/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DownloadManifestOperation.cs index 13469d1..294dec9 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DownloadManifestOperation.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/Operations/Internal/DownloadManifestOperation.cs @@ -74,7 +74,7 @@ namespace YooAsset string savePath = PersistentTools.GetPersistent(_packageName).GetSandboxPackageManifestFilePath(_packageVersion); string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_packageName, _packageVersion); string webURL = GetDownloadRequestURL(fileName); - YooLogger.Log($"Beginning to download manifest file : {webURL}"); + YooLogger.Log($"Beginning to download package manifest file : {webURL}"); _downloader2 = new UnityWebFileRequester(); _downloader2.SendRequest(webURL, savePath, _timeout); } diff --git a/Assets/YooAsset/Runtime/PackageSystem/Operations/UpdatePackageManifestOperation.cs b/Assets/YooAsset/Runtime/PackageSystem/Operations/UpdatePackageManifestOperation.cs index 3a31381..f60ef8c 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/Operations/UpdatePackageManifestOperation.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/Operations/UpdatePackageManifestOperation.cs @@ -58,6 +58,7 @@ namespace YooAsset private enum ESteps { None, + CheckParams, CheckActiveManifest, TryLoadCacheManifest, DownloadManifest, @@ -87,13 +88,34 @@ namespace YooAsset } internal override void Start() { - _steps = ESteps.CheckActiveManifest; + _steps = ESteps.CheckParams; } internal override void Update() { if (_steps == ESteps.None || _steps == ESteps.Done) return; + if (_steps == ESteps.CheckParams) + { + if (string.IsNullOrEmpty(_packageName)) + { + _steps = ESteps.Done; + Status = EOperationStatus.Failed; + Error = "Package name is null or empty."; + return; + } + + if (string.IsNullOrEmpty(_packageVersion)) + { + _steps = ESteps.Done; + Status = EOperationStatus.Failed; + Error = "Package version is null or empty."; + return; + } + + _steps = ESteps.CheckActiveManifest; + } + if (_steps == ESteps.CheckActiveManifest) { // 检测当前激活的清单对象 @@ -198,6 +220,7 @@ namespace YooAsset private enum ESteps { None, + CheckParams, CheckActiveManifest, LoadRemoteManifest, Done, @@ -220,13 +243,34 @@ namespace YooAsset } internal override void Start() { - _steps = ESteps.CheckActiveManifest; + _steps = ESteps.CheckParams; } internal override void Update() { if (_steps == ESteps.None || _steps == ESteps.Done) return; + if (_steps == ESteps.CheckParams) + { + if (string.IsNullOrEmpty(_packageName)) + { + _steps = ESteps.Done; + Status = EOperationStatus.Failed; + Error = "Package name is null or empty."; + return; + } + + if (string.IsNullOrEmpty(_packageVersion)) + { + _steps = ESteps.Done; + Status = EOperationStatus.Failed; + Error = "Package version is null or empty."; + return; + } + + _steps = ESteps.CheckActiveManifest; + } + if (_steps == ESteps.CheckActiveManifest) { // 检测当前激活的清单对象