diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index c6572c5ed2..5b528b7e89 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -62,6 +62,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..00d66053a7 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 = delegate { + var beatmap = list.FirstVisibleSet?.Beatmaps?.ValueAtOrDefault(0); + if (beatmap != null) playSpecified(beatmap); + }; } protected override void LoadComplete() diff --git a/osu.Game/Screens/Select/SearchTextBox.cs b/osu.Game/Screens/Select/SearchTextBox.cs index 4f2ab221cb..743b1fc5c7 100644 --- a/osu.Game/Screens/Select/SearchTextBox.cs +++ b/osu.Game/Screens/Select/SearchTextBox.cs @@ -15,6 +15,8 @@ namespace osu.Game.Screens.Select /// public class SearchTextBox : FocusedTextBox { + protected virtual bool AllowCommit => false; + public SearchTextBox() { Height = 35; @@ -45,8 +47,11 @@ namespace osu.Game.Screens.Select case Key.Right: case Key.Up: case Key.Down: - case Key.Enter: return false; + + case Key.Enter: + if (!AllowCommit) return false; + break; } }