mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 00:12:59 +08:00
Add ability to search by play criteria
This commit is contained in:
parent
26a60d898c
commit
1b40b56d41
@ -28,6 +28,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
OsuSpriteText genre;
|
||||
OsuSpriteText language;
|
||||
OsuSpriteText extra;
|
||||
OsuSpriteText played;
|
||||
|
||||
Add(control = new BeatmapListingSearchControl
|
||||
{
|
||||
@ -47,7 +48,8 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
category = new OsuSpriteText(),
|
||||
genre = new OsuSpriteText(),
|
||||
language = new OsuSpriteText(),
|
||||
extra = new OsuSpriteText()
|
||||
extra = new OsuSpriteText(),
|
||||
played = new OsuSpriteText()
|
||||
}
|
||||
});
|
||||
|
||||
@ -57,6 +59,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
control.Genre.BindValueChanged(g => genre.Text = $"Genre: {g.NewValue}", true);
|
||||
control.Language.BindValueChanged(l => language.Text = $"Language: {l.NewValue}", true);
|
||||
control.Extra.BindValueChanged(e => extra.Text = $"Extra: {e.NewValue}", true);
|
||||
control.Played.BindValueChanged(p => played.Text = $"Played: {p.NewValue}", true);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -23,6 +23,8 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
public SearchExtra Extra { get; }
|
||||
|
||||
public SearchPlayed Played { get; }
|
||||
|
||||
private readonly string query;
|
||||
private readonly RulesetInfo ruleset;
|
||||
private readonly Cursor cursor;
|
||||
@ -38,7 +40,8 @@ namespace osu.Game.Online.API.Requests
|
||||
SortDirection sortDirection = SortDirection.Descending,
|
||||
SearchGenre genre = SearchGenre.Any,
|
||||
SearchLanguage language = SearchLanguage.Any,
|
||||
SearchExtra extra = SearchExtra.Any)
|
||||
SearchExtra extra = SearchExtra.Any,
|
||||
SearchPlayed played = SearchPlayed.Any)
|
||||
{
|
||||
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
|
||||
this.ruleset = ruleset;
|
||||
@ -50,6 +53,7 @@ namespace osu.Game.Online.API.Requests
|
||||
Genre = genre;
|
||||
Language = language;
|
||||
Extra = extra;
|
||||
Played = played;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
@ -94,6 +98,9 @@ namespace osu.Game.Online.API.Requests
|
||||
req.AddParameter("e", extraString);
|
||||
}
|
||||
|
||||
if (Played != SearchPlayed.Any)
|
||||
req.AddParameter("played", Played.ToString().ToLowerInvariant());
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
|
@ -131,6 +131,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
searchControl.Genre.BindValueChanged(_ => queueUpdateSearch());
|
||||
searchControl.Language.BindValueChanged(_ => queueUpdateSearch());
|
||||
searchControl.Extra.BindValueChanged(_ => queueUpdateSearch());
|
||||
searchControl.Played.BindValueChanged(_ => queueUpdateSearch());
|
||||
|
||||
sortCriteria.BindValueChanged(_ => queueUpdateSearch());
|
||||
sortDirection.BindValueChanged(_ => queueUpdateSearch());
|
||||
@ -181,7 +182,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
sortControl.SortDirection.Value,
|
||||
searchControl.Genre.Value,
|
||||
searchControl.Language.Value,
|
||||
searchControl.Extra.Value);
|
||||
searchControl.Extra.Value,
|
||||
searchControl.Played.Value);
|
||||
|
||||
getSetsRequest.Success += response =>
|
||||
{
|
||||
|
@ -30,6 +30,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
|
||||
public Bindable<SearchExtra> Extra => extraFilter.Current;
|
||||
|
||||
public Bindable<SearchPlayed> Played => playedFilter.Current;
|
||||
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
{
|
||||
set
|
||||
@ -51,6 +53,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
private readonly BeatmapSearchFilterRow<SearchGenre> genreFilter;
|
||||
private readonly BeatmapSearchFilterRow<SearchLanguage> languageFilter;
|
||||
private readonly BeatmapSearchExtraFilterRow extraFilter;
|
||||
private readonly BeatmapSearchFilterRow<SearchPlayed> playedFilter;
|
||||
|
||||
private readonly Box background;
|
||||
private readonly UpdateableBeatmapSetCover beatmapCover;
|
||||
@ -108,7 +111,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
||||
categoryFilter = new BeatmapSearchFilterRow<SearchCategory>(@"Categories"),
|
||||
genreFilter = new BeatmapSearchFilterRow<SearchGenre>(@"Genre"),
|
||||
languageFilter = new BeatmapSearchFilterRow<SearchLanguage>(@"Language"),
|
||||
extraFilter = new BeatmapSearchExtraFilterRow()
|
||||
extraFilter = new BeatmapSearchExtraFilterRow(),
|
||||
playedFilter = new BeatmapSearchFilterRow<SearchPlayed>(@"Played")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
osu.Game/Overlays/BeatmapListing/SearchPlayed.cs
Normal file
12
osu.Game/Overlays/BeatmapListing/SearchPlayed.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapListing
|
||||
{
|
||||
public enum SearchPlayed
|
||||
{
|
||||
Any,
|
||||
Played,
|
||||
Unplayed
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user