diff --git a/osu.Game/Graphics/UserInterface/SearchTextBox.cs b/osu.Game/Graphics/UserInterface/SearchTextBox.cs index 18148e9d31..6a8236529b 100644 --- a/osu.Game/Graphics/UserInterface/SearchTextBox.cs +++ b/osu.Game/Graphics/UserInterface/SearchTextBox.cs @@ -13,6 +13,8 @@ namespace osu.Game.Graphics.UserInterface /// public class SearchTextBox : FocusedTextBox { + protected virtual bool AllowCommit => false; + public SearchTextBox() { Height = 35; @@ -43,8 +45,10 @@ namespace osu.Game.Graphics.UserInterface case Key.Right: case Key.Up: case Key.Down: - case Key.Enter: return false; + case Key.Enter: + if (!AllowCommit) return false; + break; } } diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index 0b4e067fff..f6188d941c 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -61,6 +61,7 @@ namespace osu.Game.Overlays.Music protected override Color4 BackgroundUnfocused => backgroundColour; protected override Color4 BackgroundFocused => backgroundColour; + protected override bool AllowCommit => true; public FilterTextBox() { diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index da31e94e22..c2413956b4 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -132,6 +132,10 @@ namespace osu.Game.Overlays.Music FadeTo(matching ? 1 : 0, 200); } + get + { + return matching; + } } } } diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index c7909f1a63..ffe59a9d93 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -22,6 +22,8 @@ namespace osu.Game.Overlays.Music } } + public BeatmapSetInfo FirstVisibleSet => items.Children.FirstOrDefault(i => i.MatchingCurrentFilter)?.BeatmapSetInfo; + private void itemSelected(BeatmapSetInfo b) { OnSelect?.Invoke(b); diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 92b8addd97..eb5dff57b3 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -84,6 +84,11 @@ namespace osu.Game.Overlays.Music list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren().ToList(); beatmapBacking.BindTo(game.Beatmap); + + filter.Search.OnCommit = (sender, newText) => { + var beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault(); + if (beatmap != null) playSpecified(beatmap); + }; } protected override void LoadComplete()