AlicizaX/Client/Assets/Scripts/Startup/Procedure/PatchUpdater/ProcedureGetAppVersionInfoState.cs
2025-10-14 15:42:34 +08:00

49 lines
1.2 KiB
C#

using System;
using Cysharp.Threading.Tasks;
using AlicizaX;
using UnityEngine;
using YooAsset;
namespace Unity.Startup.Procedure
{
/// <summary>
/// 获取版本信息
/// </summary>
public sealed class ProcedureGetAppVersionInfoState : StateBase<UpdateProcedureState>
{
protected override void OnEnter()
{
base.OnEnter();
GetAppVersionInfo();
}
private async void GetAppVersionInfo()
{
try
{
if (HttpHelper.Version != AppVersion.GameVersion)
{
Log.Warning($"Version inconsistency : {AppVersion.GameVersion}->{HttpHelper.Version} ");
#if UNITY_EDITOR
UnityEditor.EditorApplication.isPlaying = false;
#else
Application.OpenURL(HttpHelper.AppDownloadUrl);
Application.Quit();
#endif
return;
}
SwitchState(UpdateProcedureState.ProcedureInitPackageState);
}
catch (Exception e)
{
Log.Exception(e);
await UniTask.Delay(3000);
GetAppVersionInfo();
}
}
}
}