Merge pull request #79 from Crystalwarrior/ClientFixes
Chat tweaks and fixes
This commit is contained in:
@@ -69,7 +69,10 @@ namespace Barotrauma.Networking
|
|||||||
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Dead];
|
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Dead];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
|
if (command != "") //PMing
|
||||||
|
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Private];
|
||||||
|
else
|
||||||
|
textBox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ namespace Barotrauma
|
|||||||
private GUIListBox jobList;
|
private GUIListBox jobList;
|
||||||
|
|
||||||
private GUITextBox textBox, seedBox;
|
private GUITextBox textBox, seedBox;
|
||||||
|
public GUITextBox TextBox
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return textBox;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private GUIFrame defaultModeContainer, campaignContainer;
|
private GUIFrame defaultModeContainer, campaignContainer;
|
||||||
|
|
||||||
@@ -1092,7 +1099,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 20, 0),
|
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 20, 0),
|
||||||
message.TextWithSender,
|
(message.Type == ChatMessageType.Private ? "[PM] " : "") + message.TextWithSender,
|
||||||
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color,
|
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color,
|
||||||
Alignment.Left, Alignment.TopLeft, "", null, true, GUI.SmallFont);
|
Alignment.Left, Alignment.TopLeft, "", null, true, GUI.SmallFont);
|
||||||
msg.UserData = message;
|
msg.UserData = message;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace Barotrauma.Networking
|
|||||||
new Color(63, 72, 204), //dead
|
new Color(63, 72, 204), //dead
|
||||||
new Color(157, 225, 160), //server
|
new Color(157, 225, 160), //server
|
||||||
new Color(238, 208, 0), //radio
|
new Color(238, 208, 0), //radio
|
||||||
new Color(228, 199, 27) //private
|
new Color(64, 240, 89) //private
|
||||||
};
|
};
|
||||||
|
|
||||||
public readonly string Text;
|
public readonly string Text;
|
||||||
@@ -185,7 +185,7 @@ namespace Barotrauma.Networking
|
|||||||
GameMain.Server.SendChatMessage(denyMsg, c);
|
GameMain.Server.SendChatMessage(denyMsg, c);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (c.Character != null && !c.Character.CanSpeak) return;
|
||||||
GameMain.Server.SendChatMessage(txt, null, c);
|
GameMain.Server.SendChatMessage(txt, null, c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(message.SenderName))
|
if (!string.IsNullOrWhiteSpace(message.SenderName))
|
||||||
{
|
{
|
||||||
displayedText = message.SenderName + ": " + displayedText;
|
displayedText = (message.Type == ChatMessageType.Private ? "[PM] " : "" ) + message.SenderName + ": " + displayedText;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 40, 0), displayedText,
|
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 40, 0), displayedText,
|
||||||
@@ -205,9 +205,10 @@ namespace Barotrauma.Networking
|
|||||||
public virtual void Update(float deltaTime)
|
public virtual void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
|
GUITextBox msgBox = (Screen.Selected == GameMain.GameScreen ? chatMsgBox : GameMain.NetLobbyScreen.TextBox);
|
||||||
if (gameStarted && Screen.Selected == GameMain.GameScreen)
|
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);
|
inGameHUD.Update(deltaTime);
|
||||||
|
|
||||||
@@ -222,22 +223,21 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
//tab doesn't autoselect the chatbox when debug console is open,
|
//tab doesn't autoselect the chatbox when debug console is open,
|
||||||
//because tab is used for autocompleting console commands
|
//because tab is used for autocompleting console commands
|
||||||
if ((PlayerInput.KeyHit(InputType.Chat) || PlayerInput.KeyHit(InputType.RadioChat)) &&
|
if ((PlayerInput.KeyHit(InputType.Chat) || PlayerInput.KeyHit(InputType.RadioChat)) &&
|
||||||
chatMsgBox.Visible && !DebugConsole.IsOpen)
|
(!DebugConsole.IsOpen && GUIComponent.KeyboardDispatcher.Subscriber == null) && (Screen.Selected != GameMain.GameScreen || msgBox.Visible))
|
||||||
{
|
{
|
||||||
if (chatMsgBox.Selected)
|
if (msgBox.Selected)
|
||||||
{
|
{
|
||||||
chatMsgBox.Text = "";
|
msgBox.Text = "";
|
||||||
chatMsgBox.Deselect();
|
msgBox.Deselect();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
chatMsgBox.Select();
|
msgBox.Select();
|
||||||
if (PlayerInput.KeyHit(InputType.RadioChat))
|
if (Screen.Selected == GameMain.GameScreen && PlayerInput.KeyHit(InputType.RadioChat))
|
||||||
{
|
{
|
||||||
chatMsgBox.Text = "r; ";
|
msgBox.Text = "r; ";
|
||||||
chatMsgBox.OnTextChanged?.Invoke(chatMsgBox, chatMsgBox.Text);
|
msgBox.OnTextChanged?.Invoke(msgBox, msgBox.Text);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user