1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 00:47:24 +08:00

Add ability to set extra parameters to SearchBeatmapSetsRequest

This commit is contained in:
Andrei Zavatski 2020-10-27 20:13:18 +03:00
parent 37e9e39ee8
commit 742a96484b
2 changed files with 40 additions and 1 deletions

View File

@ -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;
}

View 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
}
}