mirror of
https://github.com/ppy/osu
synced 2025-03-04 10:29:37 +00:00
Add ability to set extra parameters to SearchBeatmapSetsRequest
This commit is contained in:
parent
37e9e39ee8
commit
742a96484b
@ -21,6 +21,8 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
public SearchLanguage Language { get; }
|
||||
|
||||
public SearchExtra Extra { get; }
|
||||
|
||||
private readonly string query;
|
||||
private readonly RulesetInfo ruleset;
|
||||
private readonly Cursor cursor;
|
||||
@ -35,7 +37,8 @@ namespace osu.Game.Online.API.Requests
|
||||
SortCriteria sortCriteria = SortCriteria.Ranked,
|
||||
SortDirection sortDirection = SortDirection.Descending,
|
||||
SearchGenre genre = SearchGenre.Any,
|
||||
SearchLanguage language = SearchLanguage.Any)
|
||||
SearchLanguage language = SearchLanguage.Any,
|
||||
SearchExtra extra = SearchExtra.Any)
|
||||
{
|
||||
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
|
||||
this.ruleset = ruleset;
|
||||
@ -46,6 +49,7 @@ namespace osu.Game.Online.API.Requests
|
||||
SortDirection = sortDirection;
|
||||
Genre = genre;
|
||||
Language = language;
|
||||
Extra = extra;
|
||||
}
|
||||
|
||||
protected override WebRequest CreateWebRequest()
|
||||
@ -68,6 +72,28 @@ namespace osu.Game.Online.API.Requests
|
||||
|
||||
req.AddCursor(cursor);
|
||||
|
||||
if (Extra != SearchExtra.Any)
|
||||
{
|
||||
string extraString = string.Empty;
|
||||
|
||||
switch (Extra)
|
||||
{
|
||||
case SearchExtra.Both:
|
||||
extraString = "video.storyboard";
|
||||
break;
|
||||
|
||||
case SearchExtra.Storyboard:
|
||||
extraString = "storyboard";
|
||||
break;
|
||||
|
||||
case SearchExtra.Video:
|
||||
extraString = "video";
|
||||
break;
|
||||
}
|
||||
|
||||
req.AddParameter("e", extraString);
|
||||
}
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
|
13
osu.Game/Overlays/BeatmapListing/SearchExtra.cs
Normal file
13
osu.Game/Overlays/BeatmapListing/SearchExtra.cs
Normal file
@ -0,0 +1,13 @@
|
||||
// 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 SearchExtra
|
||||
{
|
||||
Video,
|
||||
Storyboard,
|
||||
Both,
|
||||
Any
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user