update package system

增加对清单激活的检测
mlyDevMerge1.5.7
hevinci 2023-07-19 18:18:03 +08:00 committed by QiJing
parent e3fe9535cb
commit b70083e388
1 changed files with 10 additions and 6 deletions

View File

@ -238,7 +238,7 @@ namespace YooAsset
/// <param name="timeout">超时时间默认值60秒</param>
public UpdatePackageVersionOperation UpdatePackageVersionAsync(bool appendTimeTicks = true, int timeout = 60)
{
DebugCheckInitialize();
DebugCheckInitialize(false);
return _playModeServices.UpdatePackageVersionAsync(appendTimeTicks, timeout);
}
@ -250,7 +250,7 @@ namespace YooAsset
/// <param name="timeout">超时时间默认值60秒</param>
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
/// <param name="timeout">超时时间默认值60秒</param>
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")]