public static void Open() { if (!isClosed) { return; } isClosed = false; var menu = new MenuCharacterCreation(); instance = menu; Api.Client.UI.LayoutRootChildren.Add(instance); Menu.CloseAll(); // ReSharper disable once CanExtractXamlLocalizableStringCSharp inputContext = ClientInputContext.Start("Character creation menu - intercept all other input") .HandleAll( () => { if (ClientInputManager.IsButtonDown(GameButton.CancelOrClose)) { MainMenuOverlay.Toggle(); } ClientInputManager.ConsumeAllButtons(); }); }
private void Open() { if (this.isOpened) { return; } this.isOpened = true; this.UpdateLayout(); this.storyboardFadeIn?.Begin(this); Menu.CloseAll(); // ReSharper disable once CanExtractXamlLocalizableStringCSharp inputContext = ClientInputContext.Start("Respawn menu - intercept all other input") .HandleAll( () => { if (ClientInputManager.IsButtonDown(GameButton.CancelOrClose)) { MainMenuOverlay.Toggle(); } ClientInputManager.ConsumeAllButtons(); }); }
public override void Update(double deltaTime) { var loadingScreenState = LoadingSplashScreenManager.Instance.CurrentState; if (loadingScreenState == LoadingSplashScreenState.Shown || loadingScreenState == LoadingSplashScreenState.Showing) { // don't process input while the loading screen is shown or showing // (except for the console) if (IsButtonDown(GameButton.ToggleDeveloperConsole, evenIfHandled: true)) { ConsoleControl.Toggle(); } // (except for the main menu) if (IsButtonDown(GameButton.CancelOrClose)) { MainMenuOverlay.Toggle(); } return; } // acquire frozen list of contexts var contexts = ClientInputContext.CurrentContexts.FrozenList; // iterate it in the reverse order for (var index = contexts.Count - 1; index >= 0; index--) { var context = contexts[index]; context.Update(); } }
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; }