mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Merge pull request #722 from DrabWeb/playlist-commit
Play first visible set in playlist on commit
This commit is contained in:
commit
08f980ccae
@ -13,6 +13,8 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
{
|
||||
|
@ -132,6 +132,10 @@ namespace osu.Game.Overlays.Music
|
||||
|
||||
FadeTo(matching ? 1 : 0, 200);
|
||||
}
|
||||
get
|
||||
{
|
||||
return matching;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -84,6 +84,11 @@ namespace osu.Game.Overlays.Music
|
||||
list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren<BeatmapSetInfo>().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()
|
||||
|
Loading…
Reference in New Issue
Block a user