Chat now sends formatted messages to allow more complex messages.

This commit is contained in:
Pieter-Jan Briers
2021-02-28 18:51:30 +01:00
parent 11c42f1d59
commit cb8d7730ad
3 changed files with 33 additions and 2 deletions

View File

@@ -154,6 +154,20 @@ namespace Content.Client.Chat
Contents.AddMessage(formatted);
}
public void AddLine(FormattedMessage message, Color color)
{
if (Disposed)
{
return;
}
var formatted = new FormattedMessage(3);
formatted.PushColor(color);
formatted.AddMessage(message);
formatted.Pop();
Contents.AddMessage(formatted);
}
private void Input_OnTextEntered(LineEdit.LineEditEventArgs args)
{
// We set it there to true so it's set to false by TextSubmitted.Invoke if necessary

View File

@@ -222,7 +222,7 @@ namespace Content.Client.Chat
};
}
_currentChatBox?.AddLine(messageText, message.Channel, color);
_currentChatBox?.AddLine(FormattedMessage.FromMarkup(messageText), color);
}
private void OnChatBoxTextSubmitted(ChatBox chatBox, string text)
@@ -422,7 +422,7 @@ namespace Content.Client.Chat
return;
}
var messages = SplitMessage(msg.Message);
var messages = SplitMessage(FormattedMessage.RemoveMarkup(msg.Message));
foreach (var message in messages)
{