1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 14:32:55 +08:00

Move and shorten enum names

This commit is contained in:
Dean Herbert 2020-04-21 15:37:50 +09:00
parent 89320b510c
commit c2ed6491a9
6 changed files with 119 additions and 101 deletions

View File

@ -8,7 +8,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapListing;
using osuTK;
@ -41,8 +40,8 @@ namespace osu.Game.Tests.Visual.UserInterface
Children = new Drawable[]
{
new BeatmapSearchRulesetFilterRow(),
new BeatmapSearchFilterRow<BeatmapSearchCategory>("Categories"),
new BeatmapSearchFilterRow<BeatmapSearchCategory>("Header Name")
new BeatmapSearchFilterRow<SearchCategory>("Categories"),
new BeatmapSearchFilterRow<SearchCategory>("Header Name")
}
});
}

View File

@ -1,26 +1,25 @@
// 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;
using osu.Framework.IO.Network;
using osu.Game.Overlays;
using osu.Game.Overlays.BeatmapListing;
using osu.Game.Overlays.Direct;
using osu.Game.Rulesets;
using osu.Game.Utils;
namespace osu.Game.Online.API.Requests
{
public class SearchBeatmapSetsRequest : APIRequest<SearchBeatmapSetsResponse>
{
public BeatmapSearchCategory SearchCategory { get; set; }
public SearchCategory SearchCategory { get; set; }
public DirectSortCriteria SortCriteria { get; set; }
public SortDirection SortDirection { get; set; }
public BeatmapSearchGenre Genre { get; set; }
public SearchGenre Genre { get; set; }
public BeatmapSearchLanguage Language { get; set; }
public SearchLanguage Language { get; set; }
private readonly string query;
private readonly RulesetInfo ruleset;
@ -32,11 +31,11 @@ namespace osu.Game.Online.API.Requests
this.query = string.IsNullOrEmpty(query) ? string.Empty : System.Uri.EscapeDataString(query);
this.ruleset = ruleset;
SearchCategory = BeatmapSearchCategory.Any;
SearchCategory = SearchCategory.Any;
SortCriteria = DirectSortCriteria.Ranked;
SortDirection = SortDirection.Descending;
Genre = BeatmapSearchGenre.Any;
Language = BeatmapSearchLanguage.Any;
Genre = SearchGenre.Any;
Language = SearchLanguage.Any;
}
protected override WebRequest CreateWebRequest()
@ -49,10 +48,10 @@ namespace osu.Game.Online.API.Requests
req.AddParameter("s", SearchCategory.ToString().ToLowerInvariant());
if (Genre != BeatmapSearchGenre.Any)
if (Genre != SearchGenre.Any)
req.AddParameter("g", ((int)Genre).ToString());
if (Language != BeatmapSearchLanguage.Any)
if (Language != SearchLanguage.Any)
req.AddParameter("l", ((int)Language).ToString());
req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");
@ -62,81 +61,4 @@ namespace osu.Game.Online.API.Requests
protected override string Target => @"beatmapsets/search";
}
public enum BeatmapSearchCategory
{
Any,
[Description("Has Leaderboard")]
Leaderboard,
Ranked,
Qualified,
Loved,
Favourites,
[Description("Pending & WIP")]
Pending,
Graveyard,
[Description("My Maps")]
Mine,
}
public enum BeatmapSearchGenre
{
Any = 0,
Unspecified = 1,
[Description("Video Game")]
VideoGame = 2,
Anime = 3,
Rock = 4,
Pop = 5,
Other = 6,
Novelty = 7,
[Description("Hip Hop")]
HipHop = 9,
Electronic = 10
}
[HasOrderedElements]
public enum BeatmapSearchLanguage
{
[Order(0)]
Any,
[Order(11)]
Other,
[Order(1)]
English,
[Order(6)]
Japanese,
[Order(2)]
Chinese,
[Order(10)]
Instrumental,
[Order(7)]
Korean,
[Order(3)]
French,
[Order(4)]
German,
[Order(9)]
Swedish,
[Order(8)]
Spanish,
[Order(5)]
Italian
}
}

View File

@ -5,7 +5,6 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Online.API.Requests;
using osuTK;
using osu.Framework.Bindables;
using osu.Game.Beatmaps.Drawables;
@ -23,11 +22,11 @@ namespace osu.Game.Overlays.BeatmapListing
public Bindable<RulesetInfo> Ruleset => modeFilter.Current;
public Bindable<BeatmapSearchCategory> Category => categoryFilter.Current;
public Bindable<SearchCategory> Category => categoryFilter.Current;
public Bindable<BeatmapSearchGenre> Genre => genreFilter.Current;
public Bindable<SearchGenre> Genre => genreFilter.Current;
public Bindable<BeatmapSearchLanguage> Language => languageFilter.Current;
public Bindable<SearchLanguage> Language => languageFilter.Current;
public BeatmapSetInfo BeatmapSet
{
@ -46,9 +45,9 @@ namespace osu.Game.Overlays.BeatmapListing
private readonly BeatmapSearchTextBox textBox;
private readonly BeatmapSearchRulesetFilterRow modeFilter;
private readonly BeatmapSearchFilterRow<BeatmapSearchCategory> categoryFilter;
private readonly BeatmapSearchFilterRow<BeatmapSearchGenre> genreFilter;
private readonly BeatmapSearchFilterRow<BeatmapSearchLanguage> languageFilter;
private readonly BeatmapSearchFilterRow<SearchCategory> categoryFilter;
private readonly BeatmapSearchFilterRow<SearchGenre> genreFilter;
private readonly BeatmapSearchFilterRow<SearchLanguage> languageFilter;
private readonly Box background;
private readonly UpdateableBeatmapSetCover beatmapCover;
@ -103,9 +102,9 @@ namespace osu.Game.Overlays.BeatmapListing
Children = new Drawable[]
{
modeFilter = new BeatmapSearchRulesetFilterRow(),
categoryFilter = new BeatmapSearchFilterRow<BeatmapSearchCategory>(@"Categories"),
genreFilter = new BeatmapSearchFilterRow<BeatmapSearchGenre>(@"Genre"),
languageFilter = new BeatmapSearchFilterRow<BeatmapSearchLanguage>(@"Language"),
categoryFilter = new BeatmapSearchFilterRow<SearchCategory>(@"Categories"),
genreFilter = new BeatmapSearchFilterRow<SearchGenre>(@"Genre"),
languageFilter = new BeatmapSearchFilterRow<SearchLanguage>(@"Language"),
}
}
}
@ -113,7 +112,7 @@ namespace osu.Game.Overlays.BeatmapListing
}
});
categoryFilter.Current.Value = BeatmapSearchCategory.Leaderboard;
categoryFilter.Current.Value = SearchCategory.Leaderboard;
}
[BackgroundDependencyLoader]

View File

@ -0,0 +1,26 @@
// 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 SearchCategory
{
Any,
[Description("Has Leaderboard")]
Leaderboard,
Ranked,
Qualified,
Loved,
Favourites,
[Description("Pending & WIP")]
Pending,
Graveyard,
[Description("My Maps")]
Mine,
}
}

View File

@ -0,0 +1,25 @@
// 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 SearchGenre
{
Any = 0,
Unspecified = 1,
[Description("Video Game")]
VideoGame = 2,
Anime = 3,
Rock = 4,
Pop = 5,
Other = 6,
Novelty = 7,
[Description("Hip Hop")]
HipHop = 9,
Electronic = 10
}
}

View File

@ -0,0 +1,47 @@
// 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 osu.Game.Utils;
namespace osu.Game.Overlays.BeatmapListing
{
[HasOrderedElements]
public enum SearchLanguage
{
[Order(0)]
Any,
[Order(11)]
Other,
[Order(1)]
English,
[Order(6)]
Japanese,
[Order(2)]
Chinese,
[Order(10)]
Instrumental,
[Order(7)]
Korean,
[Order(3)]
French,
[Order(4)]
German,
[Order(9)]
Swedish,
[Order(8)]
Spanish,
[Order(5)]
Italian
}
}