mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Add new beatmap search filter row "General"
This commit is contained in:
@ -15,6 +15,9 @@ namespace osu.Game.Online.API.Requests
|
|||||||
{
|
{
|
||||||
public class SearchBeatmapSetsRequest : APIRequest<SearchBeatmapSetsResponse>
|
public class SearchBeatmapSetsRequest : APIRequest<SearchBeatmapSetsResponse>
|
||||||
{
|
{
|
||||||
|
[CanBeNull]
|
||||||
|
public IReadOnlyCollection<SearchGeneral> General { get; }
|
||||||
|
|
||||||
public SearchCategory SearchCategory { get; }
|
public SearchCategory SearchCategory { get; }
|
||||||
|
|
||||||
public SortCriteria SortCriteria { get; }
|
public SortCriteria SortCriteria { get; }
|
||||||
@ -45,6 +48,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
string query,
|
string query,
|
||||||
RulesetInfo ruleset,
|
RulesetInfo ruleset,
|
||||||
Cursor cursor = null,
|
Cursor cursor = null,
|
||||||
|
IReadOnlyCollection<SearchGeneral> general = null,
|
||||||
SearchCategory searchCategory = SearchCategory.Any,
|
SearchCategory searchCategory = SearchCategory.Any,
|
||||||
SortCriteria sortCriteria = SortCriteria.Ranked,
|
SortCriteria sortCriteria = SortCriteria.Ranked,
|
||||||
SortDirection sortDirection = SortDirection.Descending,
|
SortDirection sortDirection = SortDirection.Descending,
|
||||||
@ -59,6 +63,7 @@ namespace osu.Game.Online.API.Requests
|
|||||||
this.ruleset = ruleset;
|
this.ruleset = ruleset;
|
||||||
this.cursor = cursor;
|
this.cursor = cursor;
|
||||||
|
|
||||||
|
General = general;
|
||||||
SearchCategory = searchCategory;
|
SearchCategory = searchCategory;
|
||||||
SortCriteria = sortCriteria;
|
SortCriteria = sortCriteria;
|
||||||
SortDirection = sortDirection;
|
SortDirection = sortDirection;
|
||||||
@ -75,6 +80,9 @@ namespace osu.Game.Online.API.Requests
|
|||||||
var req = base.CreateWebRequest();
|
var req = base.CreateWebRequest();
|
||||||
req.AddParameter("q", query);
|
req.AddParameter("q", query);
|
||||||
|
|
||||||
|
if (General != null && General.Any())
|
||||||
|
req.AddParameter("c", string.Join('.', General.Select(e => e.ToString().ToLowerInvariant())));
|
||||||
|
|
||||||
if (ruleset.ID.HasValue)
|
if (ruleset.ID.HasValue)
|
||||||
req.AddParameter("m", ruleset.ID.Value.ToString());
|
req.AddParameter("m", ruleset.ID.Value.ToString());
|
||||||
|
|
||||||
|
@ -134,6 +134,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
queueUpdateSearch(true);
|
queueUpdateSearch(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
searchControl.General.CollectionChanged += (_, __) => queueUpdateSearch();
|
||||||
searchControl.Ruleset.BindValueChanged(_ => queueUpdateSearch());
|
searchControl.Ruleset.BindValueChanged(_ => queueUpdateSearch());
|
||||||
searchControl.Category.BindValueChanged(_ => queueUpdateSearch());
|
searchControl.Category.BindValueChanged(_ => queueUpdateSearch());
|
||||||
searchControl.Genre.BindValueChanged(_ => queueUpdateSearch());
|
searchControl.Genre.BindValueChanged(_ => queueUpdateSearch());
|
||||||
@ -187,6 +188,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
searchControl.Query.Value,
|
searchControl.Query.Value,
|
||||||
searchControl.Ruleset.Value,
|
searchControl.Ruleset.Value,
|
||||||
lastResponse?.Cursor,
|
lastResponse?.Cursor,
|
||||||
|
searchControl.General,
|
||||||
searchControl.Category.Value,
|
searchControl.Category.Value,
|
||||||
sortControl.Current.Value,
|
sortControl.Current.Value,
|
||||||
sortControl.SortDirection.Value,
|
sortControl.SortDirection.Value,
|
||||||
|
@ -29,6 +29,8 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
|
|
||||||
public Bindable<string> Query => textBox.Current;
|
public Bindable<string> Query => textBox.Current;
|
||||||
|
|
||||||
|
public BindableList<SearchGeneral> General => generalFilter.Current;
|
||||||
|
|
||||||
public Bindable<RulesetInfo> Ruleset => modeFilter.Current;
|
public Bindable<RulesetInfo> Ruleset => modeFilter.Current;
|
||||||
|
|
||||||
public Bindable<SearchCategory> Category => categoryFilter.Current;
|
public Bindable<SearchCategory> Category => categoryFilter.Current;
|
||||||
@ -61,6 +63,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly BeatmapSearchTextBox textBox;
|
private readonly BeatmapSearchTextBox textBox;
|
||||||
|
private readonly BeatmapSearchMultipleSelectionFilterRow<SearchGeneral> generalFilter;
|
||||||
private readonly BeatmapSearchRulesetFilterRow modeFilter;
|
private readonly BeatmapSearchRulesetFilterRow modeFilter;
|
||||||
private readonly BeatmapSearchFilterRow<SearchCategory> categoryFilter;
|
private readonly BeatmapSearchFilterRow<SearchCategory> categoryFilter;
|
||||||
private readonly BeatmapSearchFilterRow<SearchGenre> genreFilter;
|
private readonly BeatmapSearchFilterRow<SearchGenre> genreFilter;
|
||||||
@ -123,6 +126,7 @@ namespace osu.Game.Overlays.BeatmapListing
|
|||||||
Padding = new MarginPadding { Horizontal = 10 },
|
Padding = new MarginPadding { Horizontal = 10 },
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
|
generalFilter = new BeatmapSearchMultipleSelectionFilterRow<SearchGeneral>(@"General"),
|
||||||
modeFilter = new BeatmapSearchRulesetFilterRow(),
|
modeFilter = new BeatmapSearchRulesetFilterRow(),
|
||||||
categoryFilter = new BeatmapSearchFilterRow<SearchCategory>(@"Categories"),
|
categoryFilter = new BeatmapSearchFilterRow<SearchCategory>(@"Categories"),
|
||||||
genreFilter = new BeatmapSearchFilterRow<SearchGenre>(@"Genre"),
|
genreFilter = new BeatmapSearchFilterRow<SearchGenre>(@"Genre"),
|
||||||
|
19
osu.Game/Overlays/BeatmapListing/SearchGeneral.cs
Normal file
19
osu.Game/Overlays/BeatmapListing/SearchGeneral.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using System.ComponentModel;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.BeatmapListing
|
||||||
|
{
|
||||||
|
public enum SearchGeneral
|
||||||
|
{
|
||||||
|
[Description("Recommended difficulty")]
|
||||||
|
Recommended,
|
||||||
|
|
||||||
|
[Description("Include converted beatmaps")]
|
||||||
|
Converts,
|
||||||
|
|
||||||
|
[Description("Subscribed mappers")]
|
||||||
|
Follows
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user