Lets people use keybinds to start chatting in lobby

This commit is contained in:
Alex Noir
2017-12-05 18:01:10 +03:00
parent fde3ed40a8
commit d4ce079d65
2 changed files with 17 additions and 10 deletions

View File

@@ -33,6 +33,13 @@ namespace Barotrauma
private GUIListBox jobList;
private GUITextBox textBox, seedBox;
public GUITextBox TextBox
{
get
{
return textBox;
}
}
private GUIFrame defaultModeContainer, campaignContainer;

View File

@@ -205,9 +205,10 @@ namespace Barotrauma.Networking
public virtual void Update(float deltaTime)
{
#if CLIENT
GUITextBox msgBox = (Screen.Selected == GameMain.GameScreen ? chatMsgBox : GameMain.NetLobbyScreen.TextBox);
if (gameStarted && Screen.Selected == GameMain.GameScreen)
{
chatMsgBox.Visible = Character.Controlled == null || Character.Controlled.CanSpeak;
msgBox.Visible = Character.Controlled == null || Character.Controlled.CanSpeak;
inGameHUD.Update(deltaTime);
@@ -222,22 +223,21 @@ namespace Barotrauma.Networking
//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)) &&
chatMsgBox.Visible && !DebugConsole.IsOpen && GUIComponent.KeyboardDispatcher.Subscriber == null)
if ((PlayerInput.KeyHit(InputType.Chat) || PlayerInput.KeyHit(InputType.RadioChat)) &&
(Screen.Selected == GameMain.GameScreen && msgBox.Visible || (!DebugConsole.IsOpen && GUIComponent.KeyboardDispatcher.Subscriber == null)))
{
if (chatMsgBox.Selected)
if (msgBox.Selected)
{
chatMsgBox.Text = "";
chatMsgBox.Deselect();
msgBox.Text = "";
msgBox.Deselect();
}
else
{
chatMsgBox.Select();
msgBox.Select();
if (PlayerInput.KeyHit(InputType.RadioChat))
{
chatMsgBox.Text = "r; ";
chatMsgBox.OnTextChanged?.Invoke(chatMsgBox, chatMsgBox.Text);
msgBox.Text = "r; ";
msgBox.OnTextChanged?.Invoke(msgBox, msgBox.Text);
}
}
}