private static void RefreshCurrentGameServerConnectionState() { ClientCursorSystem.CurrentCursorId = CursorId.Default; MainMenuOverlay.UpdateActiveTab(); var currentGameService = Client.CurrentGame; var isConnected = currentGameService.ConnectionState == ConnectionState.Connected; var isConnecting = currentGameService.ConnectionState == ConnectionState.Connecting; if (!isConnected && !isConnecting && Client.MasterServer.CurrentPlayerIsLoggedIn) { var isEditor = Api.IsEditor; if (isEditor || Api.Client.Input.IsKeyHeld(InputKey.F1)) { if (isEditor) { Logger.Important("Editor mode: automatically connect to the local game server"); } currentGameService.ConnectToServer(new ServerAddress()); isConnecting = true; } } if (isConnecting) { // ReSharper disable once CanExtractXamlLocalizableStringCSharp LoadingSplashScreenManager.Show("connecting to the server"); MainMenuOverlay.IsHidden = true; return; } if (isConnected && !Client.Scene.IsEverythingLoaded) { // ensure it's shown // ReSharper disable once CanExtractXamlLocalizableStringCSharp LoadingSplashScreenManager.Show("not everything is loaded yet"); // ensure it's allowed to hide (when everything will be loaded) LoadingSplashScreenManager.Hide(); MainMenuOverlay.IsHidden = true; return; } LoadingSplashScreenManager.Hide(); if (isConnected) { // connected and everything is loaded - can play now return; } // not connected to the game server // force menu overlay in non-game mode MainMenuOverlay.IsHidden = false; }
private async void CreateCharacter() { (CharacterHumanFaceStyle style, bool isMale)selectedStyle = this.characterCustomizationControl.GetSelectedStyle(); // show splash screen LoadingSplashScreenManager.Show("Character created", displayStructureInfos: false); await LoadingSplashScreenManager.WaitShownAsync(); // select the style only now, when the loading splash is displayed, // so there is no stuttering of the loading splash screen animation CharacterStyleSystem.ClientChangeStyle(selectedStyle.style, selectedStyle.isMale); CharacterCreationSystem.ClientSelectOrigin(this.SelectedOrigin.ProtoCharacterOrigin); this.closeCallback(); // allow hiding after a short delay (it will still check whether everything is loaded) ClientTimersSystem.AddAction( delaySeconds: 1.0 + Math.Min(1, Api.Client.CurrentGame.PingGameSeconds), LoadingSplashScreenManager.Hide); }