Chatmessage GUITextBlock height matches the height of the message (-> multi-line messages don't overlap), fixed the name of the server being added to server chatmessages if there are no recipients

This commit is contained in:
Regalis
2017-03-20 20:52:10 +02:00
parent 2c688f40e3
commit fe4a8b419d
3 changed files with 10 additions and 10 deletions
+8 -8
View File
@@ -1409,7 +1409,7 @@ namespace Barotrauma.Networking
UpdateVoteStatus(); UpdateVoteStatus();
AddChatMessage(msg, ChatMessageType.Server); SendChatMessage(msg, ChatMessageType.Server);
UpdateCrewFrame(); UpdateCrewFrame();
@@ -1544,6 +1544,12 @@ namespace Barotrauma.Networking
break; break;
} }
if (type == ChatMessageType.Server)
{
senderName = null;
senderCharacter = null;
}
//check which clients can receive the message and apply distance effects //check which clients can receive the message and apply distance effects
foreach (Client client in ConnectedClients) foreach (Client client in ConnectedClients)
{ {
@@ -1571,13 +1577,7 @@ namespace Barotrauma.Networking
if (client != targetClient && client != senderClient) continue; if (client != targetClient && client != senderClient) continue;
break; break;
} }
if (type == ChatMessageType.Server)
{
senderName = null;
senderCharacter = null;
}
var chatMsg = ChatMessage.Create( var chatMsg = ChatMessage.Create(
senderName, senderName,
modifiedMessage, modifiedMessage,
@@ -248,7 +248,7 @@ namespace Barotrauma.Networking
displayedText = message.SenderName + ": " + displayedText; displayedText = message.SenderName + ": " + displayedText;
} }
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), displayedText, GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width, 0), displayedText,
((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, null, null, true); Alignment.Left, null, null, true);
msg.Font = GUI.SmallFont; msg.Font = GUI.SmallFont;
+1 -1
View File
@@ -1046,7 +1046,7 @@ namespace Barotrauma
chatBox.RemoveChild(chatBox.children[1]); chatBox.RemoveChild(chatBox.children[1]);
} }
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, 0, 20), GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width, 0),
message.TextWithSender, 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, GUI.Style, null, true); Alignment.Left, GUI.Style, null, true);