public virtual void Update(float deltaTime) { if (gameStarted && Screen.Selected == GameMain.GameScreen) { chatMsgBox.Visible = Character.Controlled == null || Character.Controlled.CanSpeak; inGameHUD.Update(deltaTime); GameMain.GameSession.CrewManager.Update(deltaTime); if (Character.Controlled == null || Character.Controlled.IsDead) { GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; GameMain.LightManager.LosEnabled = false; } } if (PlayerInput.KeyHit(InputType.Chat) && chatMsgBox.Visible) { if (chatMsgBox.Selected) { chatMsgBox.Text = ""; chatMsgBox.Deselect(); } else { chatMsgBox.Select(); } } }
// This method is overrided instead of the UpdateHUD method because this ensures the input box is selected // even when the terminal component is selected for the very first time. Doing the input box selection in the // UpdateHUD method only selects the input box on every terminal selection except for the very first time. public override void AddToGUIUpdateList() { base.AddToGUIUpdateList(); if (shouldSelectInputBox) { inputBox.Select(); shouldSelectInputBox = false; } }
public void UpdateHUD(float deltaTime) { GUITextBox msgBox = (Screen.Selected == GameMain.GameScreen ? chatBox.InputBox : GameMain.NetLobbyScreen.TextBox); if (gameStarted && Screen.Selected == GameMain.GameScreen) { if (!GUI.DisableHUD) { inGameHUD.UpdateManually(deltaTime); chatBox.Update(deltaTime); if (Character.Controlled == null) { myCharacterFrameOpenState = GameMain.NetLobbyScreen.MyCharacterFrameOpen ? myCharacterFrameOpenState + deltaTime * 5 : myCharacterFrameOpenState - deltaTime * 5; myCharacterFrameOpenState = MathHelper.Clamp(myCharacterFrameOpenState, 0.0f, 1.0f); var myCharFrame = GameMain.NetLobbyScreen.MyCharacterFrame; int padding = GameMain.GraphicsWidth - myCharFrame.Parent.Rect.Right; myCharFrame.RectTransform.AbsoluteOffset = Vector2.SmoothStep(new Vector2(-myCharFrame.Rect.Width - padding, 0.0f), new Vector2(-padding, 0), myCharacterFrameOpenState).ToPoint(); } } if (Character.Controlled == null || Character.Controlled.IsDead) { GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; GameMain.LightManager.LosEnabled = false; } } //tab doesn't autoselect the chatbox when debug console is open, //because tab is used for autocompleting console commands if ((PlayerInput.KeyHit(InputType.Chat) || PlayerInput.KeyHit(InputType.RadioChat)) && !DebugConsole.IsOpen && (Screen.Selected != GameMain.GameScreen || msgBox.Visible)) { if (msgBox.Selected) { msgBox.Text = ""; msgBox.Deselect(); } else { msgBox.Select(); if (Screen.Selected == GameMain.GameScreen && PlayerInput.KeyHit(InputType.RadioChat)) { msgBox.Text = "r; "; } } } if (ServerLog.LogFrame != null) ServerLog.LogFrame.AddToGUIUpdateList(); }
// This method is overrided instead of the UpdateHUD method because this ensures the input box is selected // even when the terminal component is selected for the very first time. Doing the input box selection in the // UpdateHUD method only selects the input box on every terminal selection except for the very first time. public override void AddToGUIUpdateList() { base.AddToGUIUpdateList(); if (!string.IsNullOrEmpty(DisplayedWelcomeMessage)) { ShowOnDisplay(DisplayedWelcomeMessage); DisplayedWelcomeMessage = ""; } if (shouldSelectInputBox) { inputBox.Select(); shouldSelectInputBox = false; } }
public virtual void Update(float deltaTime) { #if CLIENT GUITextBox msgBox = (Screen.Selected == GameMain.GameScreen ? chatMsgBox : GameMain.NetLobbyScreen.TextBox); if (gameStarted && Screen.Selected == GameMain.GameScreen) { msgBox.Visible = Character.Controlled == null || Character.Controlled.CanSpeak; if (!GUI.DisableHUD) { inGameHUD.Update(deltaTime); GameMain.GameSession.CrewManager.Update(deltaTime); } if (Character.Controlled == null || Character.Controlled.IsDead) { GameMain.GameScreen.Cam.TargetPos = Vector2.Zero; GameMain.LightManager.LosEnabled = false; } } //tab doesn't autoselect the chatbox when debug console is open, //because tab is used for autocompleting console commands if ((PlayerInput.KeyHit(InputType.Chat) || PlayerInput.KeyHit(InputType.RadioChat)) && !DebugConsole.IsOpen && (Screen.Selected != GameMain.GameScreen || msgBox.Visible)) { if (msgBox.Selected) { msgBox.Text = ""; msgBox.Deselect(); } else { msgBox.Select(); if (Screen.Selected == GameMain.GameScreen && PlayerInput.KeyHit(InputType.RadioChat)) { msgBox.Text = "r; "; msgBox.OnTextChanged?.Invoke(msgBox, msgBox.Text); } } } #endif }