1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 18:42:56 +08:00

Play first visible set in playlist when commiting in the search field.

This commit is contained in:
DrabWeb 2017-05-05 01:59:24 -03:00
parent b98ae5d7c3
commit 81d67cbe06
5 changed files with 18 additions and 1 deletions

View File

@ -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()
{

View File

@ -132,6 +132,10 @@ namespace osu.Game.Overlays.Music
FadeTo(matching ? 1 : 0, 200);
}
get
{
return matching;
}
}
}
}

View File

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

View File

@ -84,6 +84,11 @@ namespace osu.Game.Overlays.Music
list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren<BeatmapSetInfo>().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()

View File

@ -15,6 +15,8 @@ namespace osu.Game.Screens.Select
/// </summary>
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;
}
}