diff --git a/osu.Game/Overlays/Chat/ChannelListItem.cs b/osu.Game/Overlays/Chat/ChannelListItem.cs index ba1c890747..5318d2e592 100644 --- a/osu.Game/Overlays/Chat/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/ChannelListItem.cs @@ -12,7 +12,7 @@ using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { - public class ChannelListItem : ClickableContainer + public class ChannelListItem : ClickableContainer, IFilterable { private const float width_padding = 5; private const float channel_width = 150; @@ -27,6 +27,15 @@ namespace osu.Game.Overlays.Chat private Color4? joinedColour; private Color4? topicColour; + public string[] FilterTerms => new[] { Channel.Name }; + public bool MatchingCurrentFilter + { + set + { + FadeTo(value ? 1f : 0f, 100); + } + } + private Channel channel; public Channel Channel { diff --git a/osu.Game/Overlays/Chat/ChannelSection.cs b/osu.Game/Overlays/Chat/ChannelSection.cs index af61f67c99..4bbf25d96e 100644 --- a/osu.Game/Overlays/Chat/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/ChannelSection.cs @@ -11,25 +11,30 @@ using osu.Game.Online.Chat; namespace osu.Game.Overlays.Chat { - public class ChannelSection : Container + public class ChannelSection : Container, IHasFilterableChildren { private readonly FillFlowContainer items; private readonly OsuSpriteText header; + public IEnumerable FilterableChildren => items.Children.OfType(); + public string[] FilterTerms => new[] { Header }; + public bool MatchingCurrentFilter + { + set + { + FadeTo(value ? 1f : 0f, 100); + } + } + public string Header { - set - { - header.Text = value; - } + get { return header.Text; } + set { header.Text = value; } } public IEnumerable Channels { - set - { - items.Children = value.Select(c => new ChannelListItem { Channel = c }); - } + set { items.Children = value.Select(c => new ChannelListItem { Channel = c }); } } public ChannelSection() diff --git a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs index 4d0fcb52d9..4d8cc59ad0 100644 --- a/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/ChannelSelectionOverlay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Chat private readonly Triangles triangles; private readonly Box headerBg; private readonly SearchTextBox search; - private readonly FillFlowContainer sectionsFlow; + private readonly SearchContainer sectionsFlow; public IEnumerable Sections { @@ -67,11 +67,13 @@ namespace osu.Game.Overlays.Chat Padding = new MarginPadding { Top = 85 }, Children = new[] { - sectionsFlow = new FillFlowContainer + sectionsFlow = new SearchContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, + LayoutDuration = 200, + LayoutEasing = EasingTypes.OutQuint, Spacing = new Vector2(0f, 20f), Padding = new MarginPadding { Top = 20, Left = WIDTH_PADDING, Right = WIDTH_PADDING }, }, @@ -116,6 +118,8 @@ namespace osu.Game.Overlays.Chat Margin = new MarginPadding { Top = 160 }, }, }; + + search.Current.ValueChanged += newValue => sectionsFlow.SearchTerm = newValue; } [BackgroundDependencyLoader]