update package system

增加对UpdatePackageManifestOperation参数的检测
mlyDevMerge1.5.7
hevinci 2023-07-19 15:57:34 +08:00 committed by QiJing
parent 14685dd19b
commit 147859ff1e
2 changed files with 47 additions and 3 deletions

View File

@ -74,7 +74,7 @@ namespace YooAsset
string savePath = PersistentTools.GetPersistent(_packageName).GetSandboxPackageManifestFilePath(_packageVersion); string savePath = PersistentTools.GetPersistent(_packageName).GetSandboxPackageManifestFilePath(_packageVersion);
string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_packageName, _packageVersion); string fileName = YooAssetSettingsData.GetManifestBinaryFileName(_packageName, _packageVersion);
string webURL = GetDownloadRequestURL(fileName); 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 = new UnityWebFileRequester();
_downloader2.SendRequest(webURL, savePath, _timeout); _downloader2.SendRequest(webURL, savePath, _timeout);
} }

View File

@ -58,6 +58,7 @@ namespace YooAsset
private enum ESteps private enum ESteps
{ {
None, None,
CheckParams,
CheckActiveManifest, CheckActiveManifest,
TryLoadCacheManifest, TryLoadCacheManifest,
DownloadManifest, DownloadManifest,
@ -87,13 +88,34 @@ namespace YooAsset
} }
internal override void Start() internal override void Start()
{ {
_steps = ESteps.CheckActiveManifest; _steps = ESteps.CheckParams;
} }
internal override void Update() internal override void Update()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; 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) if (_steps == ESteps.CheckActiveManifest)
{ {
// 检测当前激活的清单对象 // 检测当前激活的清单对象
@ -198,6 +220,7 @@ namespace YooAsset
private enum ESteps private enum ESteps
{ {
None, None,
CheckParams,
CheckActiveManifest, CheckActiveManifest,
LoadRemoteManifest, LoadRemoteManifest,
Done, Done,
@ -220,13 +243,34 @@ namespace YooAsset
} }
internal override void Start() internal override void Start()
{ {
_steps = ESteps.CheckActiveManifest; _steps = ESteps.CheckParams;
} }
internal override void Update() internal override void Update()
{ {
if (_steps == ESteps.None || _steps == ESteps.Done) if (_steps == ESteps.None || _steps == ESteps.Done)
return; 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) if (_steps == ESteps.CheckActiveManifest)
{ {
// 检测当前激活的清单对象 // 检测当前激活的清单对象