mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:47:29 +08:00
Rank status filtering
This commit is contained in:
parent
8745948a01
commit
95cfce2950
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user