mirror of
https://github.com/ppy/osu
synced 2024-12-26 00:32:52 +00:00
Add genre and language sections to beatmapset overlay
This commit is contained in:
parent
548008c9ce
commit
cd7c03c13a
@ -173,6 +173,8 @@ namespace osu.Game.Tests.Visual.Online
|
||||
HasVideo = true,
|
||||
HasStoryboard = true,
|
||||
Covers = new BeatmapSetOnlineCovers(),
|
||||
Language = BeatmapSetOnlineLanguage.English,
|
||||
Genre = BeatmapSetOnlineGenre.Rock,
|
||||
},
|
||||
Metrics = new BeatmapSetMetrics { Ratings = Enumerable.Range(0, 11).ToArray() },
|
||||
Beatmaps = new List<BeatmapInfo>
|
||||
|
20
osu.Game/Beatmaps/BeatmapSetOnlineGenre.cs
Normal file
20
osu.Game/Beatmaps/BeatmapSetOnlineGenre.cs
Normal file
@ -0,0 +1,20 @@
|
||||
// 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.Beatmaps
|
||||
{
|
||||
public enum BeatmapSetOnlineGenre
|
||||
{
|
||||
Any = 0,
|
||||
Unspecified = 1,
|
||||
VideoGame = 2,
|
||||
Anime = 3,
|
||||
Rock = 4,
|
||||
Pop = 5,
|
||||
Other = 6,
|
||||
Novelty = 7,
|
||||
// genre_id 8 doesnt exist
|
||||
HipHop = 9,
|
||||
Electronic = 10
|
||||
}
|
||||
}
|
@ -70,6 +70,16 @@ namespace osu.Game.Beatmaps
|
||||
/// The availability of this beatmap set.
|
||||
/// </summary>
|
||||
public BeatmapSetOnlineAvailability Availability { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Beatmap set's song genre.
|
||||
/// </summary>
|
||||
public BeatmapSetOnlineGenre Genre { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Beatmap set's song language.
|
||||
/// </summary>
|
||||
public BeatmapSetOnlineLanguage Language { get; set; }
|
||||
}
|
||||
|
||||
public class BeatmapSetOnlineCovers
|
||||
|
21
osu.Game/Beatmaps/BeatmapSetOnlineLanguage.cs
Normal file
21
osu.Game/Beatmaps/BeatmapSetOnlineLanguage.cs
Normal file
@ -0,0 +1,21 @@
|
||||
// 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.Beatmaps
|
||||
{
|
||||
public enum BeatmapSetOnlineLanguage
|
||||
{
|
||||
Any = 0,
|
||||
Other = 1,
|
||||
English = 2,
|
||||
Japanese = 3,
|
||||
Chinese = 4,
|
||||
Instrumental = 5,
|
||||
Korean = 6,
|
||||
French = 7,
|
||||
German = 8,
|
||||
Swedish = 9,
|
||||
Spanish = 10,
|
||||
Italian = 11
|
||||
}
|
||||
}
|
@ -66,6 +66,12 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
[JsonProperty(@"availability")]
|
||||
private BeatmapSetOnlineAvailability availability { get; set; }
|
||||
|
||||
[JsonProperty(@"genre_id")]
|
||||
private BeatmapSetOnlineGenre genre { get; set; }
|
||||
|
||||
[JsonProperty(@"language_id")]
|
||||
private BeatmapSetOnlineLanguage language { get; set; }
|
||||
|
||||
[JsonProperty(@"beatmaps")]
|
||||
private IEnumerable<APIBeatmap> beatmaps { get; set; }
|
||||
|
||||
@ -91,6 +97,8 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
Ranked = ranked,
|
||||
LastUpdated = lastUpdated,
|
||||
Availability = availability,
|
||||
Genre = genre,
|
||||
Language = language
|
||||
},
|
||||
Beatmaps = beatmaps?.Select(b => b.ToBeatmap(rulesets)).ToList(),
|
||||
};
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
|
||||
public Info()
|
||||
{
|
||||
MetadataSection source, tags;
|
||||
MetadataSection source, tags, genre, language;
|
||||
RelativeSizeAxes = Axes.X;
|
||||
Height = 220;
|
||||
Masking = true;
|
||||
@ -88,6 +88,19 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
Children = new[]
|
||||
{
|
||||
source = new MetadataSection("Source"),
|
||||
new FillFlowContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Width = 0.5f,
|
||||
FillMode = FillMode.Fit,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
genre = new MetadataSection("Genre"),
|
||||
language = new MetadataSection("Language"),
|
||||
}
|
||||
},
|
||||
tags = new MetadataSection("Tags"),
|
||||
},
|
||||
},
|
||||
@ -119,6 +132,12 @@ namespace osu.Game.Overlays.BeatmapSet
|
||||
{
|
||||
source.Text = b.NewValue?.Metadata.Source ?? string.Empty;
|
||||
tags.Text = b.NewValue?.Metadata.Tags ?? string.Empty;
|
||||
|
||||
var genreId = b.NewValue?.OnlineInfo.Genre ?? BeatmapSetOnlineGenre.Unspecified;
|
||||
genre.Text = genreId.ToString();
|
||||
|
||||
var languageId = b.NewValue?.OnlineInfo.Language ?? BeatmapSetOnlineLanguage.Other;
|
||||
language.Text = languageId.ToString();
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user