Add text highlighting (#31442)
Co-authored-by: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> Co-authored-by: Hans Larsson <hanandlia@gmail.com> Co-authored-by: Tobias Berger <toby@tobot.dev>
This commit is contained in:
@@ -38,9 +38,10 @@ public partial class ChatBox : UIWidget
|
||||
ChatInput.Input.OnFocusExit += OnFocusExit;
|
||||
ChatInput.ChannelSelector.OnChannelSelect += OnChannelSelect;
|
||||
ChatInput.FilterButton.Popup.OnChannelFilter += OnChannelFilter;
|
||||
|
||||
ChatInput.FilterButton.Popup.OnNewHighlights += OnNewHighlights;
|
||||
_controller = UserInterfaceManager.GetUIController<ChatUIController>();
|
||||
_controller.MessageAdded += OnMessageAdded;
|
||||
_controller.HighlightsUpdated += OnHighlightsUpdated;
|
||||
_controller.RegisterChat(this);
|
||||
}
|
||||
|
||||
@@ -67,6 +68,11 @@ public partial class ChatBox : UIWidget
|
||||
AddLine(msg.WrappedMessage, color);
|
||||
}
|
||||
|
||||
private void OnHighlightsUpdated(string highlights)
|
||||
{
|
||||
ChatInput.FilterButton.Popup.UpdateHighlights(highlights);
|
||||
}
|
||||
|
||||
private void OnChannelSelect(ChatSelectChannel channel)
|
||||
{
|
||||
_controller.UpdateSelectedChannel(this);
|
||||
@@ -97,6 +103,11 @@ public partial class ChatBox : UIWidget
|
||||
}
|
||||
}
|
||||
|
||||
private void OnNewHighlights(string highlighs)
|
||||
{
|
||||
_controller.UpdateHighlights(highlighs);
|
||||
}
|
||||
|
||||
public void AddLine(string message, Color color)
|
||||
{
|
||||
var formatted = new FormattedMessage(3);
|
||||
|
||||
Reference in New Issue
Block a user