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:
vitopigno
2025-06-04 12:12:37 +02:00
committed by GitHub
parent 44000552c3
commit f8d0b0cba3
14 changed files with 417 additions and 5 deletions

View File

@@ -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);