public static void Update(GameTime gameTime) { GameTime = gameTime; KeyBoardHandler.Update(); ControllerHandler.Update(); BaseConnectScreen.UpdateConnectSet(); if (!GameInstance.IsActive) { if (CurrentScreen.CanBePaused) { Core.SetScreen(Screen.CreatePauseScreen(CurrentScreen)); } } else { if (KeyBoardHandler.KeyPressed(KeyBindings.Escape) || ControllerHandler.ButtonDown(Buttons.Start)) { CurrentScreen.EscapePressed(); } } CurrentScreen?.Update(gameTime); if (CurrentScreen.CanChat) { if (KeyBoardHandler.KeyPressed(KeyBindings.Chat) || ControllerHandler.ButtonPressed(Buttons.RightShoulder)) { if (BaseJoinServerScreen.Online || Player.SandBoxMode || GameController.IS_DEBUG_ACTIVE) { SetScreen(Screen.CreateChatScreen((CurrentScreen))); } } } MainGameFunctions.FunctionKeys(); MusicManager.Update(gameTime); GameMessage.Update(); Controls.MakeMouseVisible(); MouseHandler.Update(); LoadingDots.Update(); ForcedCrash.Update(); ServersManager.Update(); }
public static void FunctionKeys() { if (KeyBoardHandler.KeyPressed(Core.KeyBindings.ScreenShot) && Core.CurrentScreen.CanTakeScreenshot) { CaptureScreen(); } if (KeyBoardHandler.KeyPressed(Core.KeyBindings.FullScreen) && Core.CurrentScreen.CanGoFullscreen) { ToggleFullScreen(); } if (KeyBoardHandler.KeyPressed(Core.KeyBindings.DebugControl)) { Core.GameOptions.ShowDebug = !Core.GameOptions.ShowDebug; Options.SaveOptions(Core.GameOptions); } if (KeyBoardHandler.KeyPressed(Core.KeyBindings.GUIControl)) { Core.GameOptions.ShowGUI = !Core.GameOptions.ShowGUI; Options.SaveOptions(Core.GameOptions); } if (KeyBoardHandler.KeyPressed(Core.KeyBindings.MuteMusic) && Core.CurrentScreen.CanMuteMusic) { Core.GameOptions.Muted = !Core.GameOptions.Muted; MusicManager.Mute(Core.GameOptions.Muted); SoundEffectManager.Mute(Core.GameOptions.Muted); Options.SaveOptions(Core.GameOptions); Core.CurrentScreen.ToggledMute(); } if (KeyBoardHandler.KeyPressed(Core.KeyBindings.LightKey)) { Core.GameOptions.LightingEnabled = !Core.GameOptions.LightingEnabled; } if (KeyBoardHandler.KeyDown(Core.KeyBindings.DebugControl)) { if (KeyBoardHandler.KeyPressed(Keys.F)) { TextureManager.TextureList.Clear(); } if (KeyBoardHandler.KeyPressed(Keys.S)) { Core.SetWindowSize(new Vector2(1200, 680)); } if (KeyBoardHandler.KeyPressed(Keys.L)) { Logger.DisplayLog = !Logger.DisplayLog; } } if (ControllerHandler.ButtonPressed(Buttons.Back, true)) { Core.GameOptions.GamePadEnabled = !Core.GameOptions.GamePadEnabled; Core.GameMessage.ShowMessage(Core.GameOptions.GamePadEnabled ? "Enabled XBOX 360 GamePad support." : "Disabled XBOX 360 GamePad support.", 12, FontManager.MainFont, Color.White); Options.SaveOptions(Core.GameOptions); } if (KeyBoardHandler.KeyPressed(Keys.B) && KeyBoardHandler.KeyDown(Core.KeyBindings.DebugControl)) { Core.GameOptions.DrawViewBox = !Core.GameOptions.DrawViewBox; } }