using System;
using Cysharp.Threading.Tasks;
using AlicizaX;
using UnityEngine;
using YooAsset;
namespace Unity.Startup.Procedure
{
///
/// 获取版本信息
///
public sealed class ProcedureGetAppVersionInfoState : ProcedureBase
{
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;
}
SwitchProcedure();
}
catch (Exception e)
{
Log.Exception(e);
await UniTask.Delay(3000);
GetAppVersionInfo();
}
}
}
}