mirror of https://github.com/ppy/osu
Add "explicit maps" search filter control
This commit is contained in:
parent
dd809df076
commit
249be461d5
|
@ -30,6 +30,8 @@ public class SearchBeatmapSetsRequest : APIRequest<SearchBeatmapSetsResponse>
|
|||
|
||||
public SearchPlayed Played { get; }
|
||||
|
||||
public SearchExplicit Explicit { get; }
|
||||
|
||||
[CanBeNull]
|
||||
public IReadOnlyCollection<ScoreRank> Ranks { get; }
|
||||
|
||||
|
@ -50,7 +52,8 @@ public SearchBeatmapSetsRequest(
|
|||
SearchLanguage language = SearchLanguage.Any,
|
||||
IReadOnlyCollection<SearchExtra> extra = null,
|
||||
IReadOnlyCollection<ScoreRank> ranks = null,
|
||||
SearchPlayed played = SearchPlayed.Any)
|
||||
SearchPlayed played = SearchPlayed.Any,
|
||||
SearchExplicit explicitMaps = SearchExplicit.Hide)
|
||||
{
|
||||
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
|
||||
this.ruleset = ruleset;
|
||||
|
@ -64,6 +67,7 @@ public SearchBeatmapSetsRequest(
|
|||
Extra = extra;
|
||||
Ranks = ranks;
|
||||
Played = played;
|
||||
Explicit = explicitMaps;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
|
@ -93,6 +97,8 @@ protected override WebRequest CreateWebRequest()
|
|||
if (Played != SearchPlayed.Any)
|
||||
req.AddParameter("played", Played.ToString().ToLowerInvariant());
|
||||
|
||||
req.AddParameter("nsfw", Explicit == SearchExplicit.Show ? "true" : "false");
|
||||
|
||||
req.AddCursor(cursor);
|
||||
|
||||
return req;
|
||||
|
|
|
@ -141,6 +141,7 @@ protected override void LoadComplete()
|
|||
searchControl.Extra.CollectionChanged += (_, __) => queueUpdateSearch();
|
||||
searchControl.Ranks.CollectionChanged += (_, __) => queueUpdateSearch();
|
||||
searchControl.Played.BindValueChanged(_ => queueUpdateSearch());
|
||||
searchControl.Explicit.BindValueChanged(_ => queueUpdateSearch());
|
||||
|
||||
sortCriteria.BindValueChanged(_ => queueUpdateSearch());
|
||||
sortDirection.BindValueChanged(_ => queueUpdateSearch());
|
||||
|
@ -193,7 +194,8 @@ private void performRequest()
|
|||
searchControl.Language.Value,
|
||||
searchControl.Extra,
|
||||
searchControl.Ranks,
|
||||
searchControl.Played.Value);
|
||||
searchControl.Played.Value,
|
||||
searchControl.Explicit.Value);
|
||||
|
||||
getSetsRequest.Success += response =>
|
||||
{
|
||||
|
|
|
@ -42,6 +42,8 @@ public class BeatmapListingSearchControl : CompositeDrawable
|
|||
|
||||
public Bindable<SearchPlayed> Played => playedFilter.Current;
|
||||
|
||||
public Bindable<SearchExplicit> Explicit => explicitFilter.Current;
|
||||
|
||||
public BeatmapSetInfo BeatmapSet
|
||||
{
|
||||
set
|
||||
|
@ -65,6 +67,7 @@ public BeatmapSetInfo BeatmapSet
|
|||
private readonly BeatmapSearchMultipleSelectionFilterRow<SearchExtra> extraFilter;
|
||||
private readonly BeatmapSearchScoreFilterRow ranksFilter;
|
||||
private readonly BeatmapSearchFilterRow<SearchPlayed> playedFilter;
|
||||
private readonly BeatmapSearchFilterRow<SearchExplicit> explicitFilter;
|
||||
|
||||
private readonly Box background;
|
||||
private readonly UpdateableBeatmapSetCover beatmapCover;
|
||||
|
@ -125,7 +128,8 @@ public BeatmapListingSearchControl()
|
|||
languageFilter = new BeatmapSearchFilterRow<SearchLanguage>(@"Language"),
|
||||
extraFilter = new BeatmapSearchMultipleSelectionFilterRow<SearchExtra>(@"Extra"),
|
||||
ranksFilter = new BeatmapSearchScoreFilterRow(),
|
||||
playedFilter = new BeatmapSearchFilterRow<SearchPlayed>(@"Played")
|
||||
playedFilter = new BeatmapSearchFilterRow<SearchPlayed>(@"Played"),
|
||||
explicitFilter = new BeatmapSearchFilterRow<SearchExplicit>(@"Explicit Maps"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
// 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 SearchExplicit
|
||||
{
|
||||
Hide,
|
||||
Show
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue