using System; using Cysharp.Threading.Tasks; using AlicizaX; using YooAsset; namespace Unity.Startup.Procedure { /// /// 获取版本信息 /// public sealed class ProcedureGetAppVersionInfoState : StateBase { protected override void OnEnter() { base.OnEnter(); // 编辑器下的模拟模式 if (GameApp.Resource.PlayMode == EPlayMode.EditorSimulateMode) { SwitchState(UpdateProcedureState.ProcedurePatchInit); return; } 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 UILoadTipWindow.ShowUILoadTip("VersionLow", () => { Application.OpenURL(HttpHelper.AppDownloadUrl); Application.Quit(); }).Forget(); #endif return; } SwitchState(UpdateProcedureState.ProcedurePatchInit); } catch (Exception e) { Log.Exception(e); await UniTask.Delay(3000); GetAppVersionInfo(); } } } }