From b70083e388f7ed3cce315a6304387144d5aa5f81 Mon Sep 17 00:00:00 2001 From: hevinci Date: Wed, 19 Jul 2023 18:18:03 +0800 Subject: [PATCH] update package system MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 增加对清单激活的检测 --- .../Runtime/PackageSystem/ResourcePackage.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs index 4877a89..cda4b67 100644 --- a/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs +++ b/Assets/YooAsset/Runtime/PackageSystem/ResourcePackage.cs @@ -238,7 +238,7 @@ namespace YooAsset /// 超时时间(默认值:60秒) public UpdatePackageVersionOperation UpdatePackageVersionAsync(bool appendTimeTicks = true, int timeout = 60) { - DebugCheckInitialize(); + DebugCheckInitialize(false); return _playModeServices.UpdatePackageVersionAsync(appendTimeTicks, timeout); } @@ -250,7 +250,7 @@ namespace YooAsset /// 超时时间(默认值:60秒) public UpdatePackageManifestOperation UpdatePackageManifestAsync(string packageVersion, bool autoSaveVersion = true, int timeout = 60) { - DebugCheckInitialize(); + DebugCheckInitialize(false); DebugCheckUpdateManifest(); return _playModeServices.UpdatePackageManifestAsync(packageVersion, autoSaveVersion, timeout); } @@ -262,7 +262,7 @@ namespace YooAsset /// 超时时间(默认值:60秒) public PreDownloadContentOperation PreDownloadContentAsync(string packageVersion, int timeout = 60) { - DebugCheckInitialize(); + DebugCheckInitialize(false); return _playModeServices.PreDownloadContentAsync(packageVersion, timeout); } @@ -294,8 +294,6 @@ namespace YooAsset public string GetPackageVersion() { DebugCheckInitialize(); - if (_playModeServices.ActiveManifest == null) - return string.Empty; return _playModeServices.ActiveManifest.PackageVersion; } @@ -967,12 +965,18 @@ namespace YooAsset #region 调试方法 [Conditional("DEBUG")] - private void DebugCheckInitialize() + private void DebugCheckInitialize(bool checkActiveManifest = true) { if (_initializeStatus == EOperationStatus.None) throw new Exception("Package initialize not completed !"); else if (_initializeStatus == EOperationStatus.Failed) throw new Exception($"Package initialize failed ! {_initializeError}"); + + if (checkActiveManifest) + { + if (_playModeServices.ActiveManifest == null) + throw new Exception("Not found active manifest !"); + } } [Conditional("DEBUG")]