1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +08:00

Rank status filtering

This commit is contained in:
DrabWeb 2017-05-28 02:43:37 -03:00
parent 8745948a01
commit 95cfce2950
2 changed files with 6 additions and 3 deletions

View File

@ -11,13 +11,15 @@ namespace osu.Game.Online.API.Requests
public class GetBeatmapSetsRequest : APIRequest<IEnumerable<GetBeatmapSetsResponse>>
{
private readonly string query;
private readonly RankStatus rankStatus;
public GetBeatmapSetsRequest(string query)
public GetBeatmapSetsRequest(string query, RankStatus rankStatus = RankStatus.Any)
{
this.query = System.Uri.EscapeDataString(query);
this.rankStatus = rankStatus;
}
protected override string Target => $@"beatmapsets/search?q={query}";
protected override string Target => $@"beatmapsets/search?q={query}&s={(int)rankStatus}";
}
public class GetBeatmapSetsResponse : BeatmapMetadata

View File

@ -172,6 +172,7 @@ namespace osu.Game.Overlays
filter.Search.Exit = Hide;
filter.Search.Current.ValueChanged += text => { if (text != string.Empty) header.Tabs.Current.Value = DirectTab.Search; };
filter.Search.OnCommit = (sender, text) => updateSets();
filter.RankStatusDropdown.Current.ValueChanged += rankStatus => updateSets();
filter.DisplayStyle.ValueChanged += recreatePanels;
updateResultCounts();
@ -216,7 +217,7 @@ namespace osu.Game.Overlays
if (api == null || filter.Search.Text == string.Empty) return;
getSetsRequest = new GetBeatmapSetsRequest(filter.Search.Text);
getSetsRequest = new GetBeatmapSetsRequest(filter.Search.Text, filter.RankStatusDropdown.Current.Value);
getSetsRequest.Success += r => BeatmapSets = r?.Select(response => response.ToSetInfo(rulesets));
api.Queue(getSetsRequest);
}