Move BeatmapSetOnlineInfo to an interface type

This commit is contained in:
Dean Herbert
2021-10-20 18:43:48 +09:00
parent ea2b2a3beb
commit 0706ad70fb
19 changed files with 222 additions and 92 deletions

View File

@ -10,10 +10,10 @@ using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIBeatmapSet : BeatmapMetadata // todo: this is a bit wrong...
public class APIBeatmapSet : BeatmapMetadata, IBeatmapSetOnlineInfo
{
[JsonProperty(@"covers")]
private BeatmapSetOnlineCovers covers { get; set; }
public BeatmapSetOnlineCovers Covers { get; set; }
private int? onlineBeatmapSetID;
@ -28,43 +28,43 @@ namespace osu.Game.Online.API.Requests.Responses
public BeatmapSetOnlineStatus Status { get; set; }
[JsonProperty(@"preview_url")]
private string preview { get; set; }
public string Preview { get; set; }
[JsonProperty(@"has_favourited")]
private bool hasFavourited { get; set; }
public bool HasFavourited { get; set; }
[JsonProperty(@"play_count")]
private int playCount { get; set; }
public int PlayCount { get; set; }
[JsonProperty(@"favourite_count")]
private int favouriteCount { get; set; }
public int FavouriteCount { get; set; }
[JsonProperty(@"bpm")]
private double bpm { get; set; }
public double BPM { get; set; }
[JsonProperty(@"nsfw")]
private bool hasExplicitContent { get; set; }
public bool HasExplicitContent { get; set; }
[JsonProperty(@"video")]
private bool hasVideo { get; set; }
public bool HasVideo { get; set; }
[JsonProperty(@"storyboard")]
private bool hasStoryboard { get; set; }
public bool HasStoryboard { get; set; }
[JsonProperty(@"submitted_date")]
private DateTimeOffset submitted { get; set; }
public DateTimeOffset Submitted { get; set; }
[JsonProperty(@"ranked_date")]
private DateTimeOffset? ranked { get; set; }
public DateTimeOffset? Ranked { get; set; }
[JsonProperty(@"last_updated")]
private DateTimeOffset lastUpdated { get; set; }
public DateTimeOffset? LastUpdated { get; set; }
[JsonProperty(@"ratings")]
private int[] ratings { get; set; }
[JsonProperty(@"track_id")]
private int? trackId { get; set; }
public int? TrackId { get; set; }
[JsonProperty(@"user_id")]
private int creatorId
@ -73,13 +73,13 @@ namespace osu.Game.Online.API.Requests.Responses
}
[JsonProperty(@"availability")]
private BeatmapSetOnlineAvailability availability { get; set; }
public BeatmapSetOnlineAvailability Availability { get; set; }
[JsonProperty(@"genre")]
private BeatmapSetOnlineGenre genre { get; set; }
public BeatmapSetOnlineGenre Genre { get; set; }
[JsonProperty(@"language")]
private BeatmapSetOnlineLanguage language { get; set; }
public BeatmapSetOnlineLanguage Language { get; set; }
[JsonProperty(@"beatmaps")]
private IEnumerable<APIBeatmap> beatmaps { get; set; }
@ -92,26 +92,7 @@ namespace osu.Game.Online.API.Requests.Responses
Metadata = this,
Status = Status,
Metrics = ratings == null ? null : new BeatmapSetMetrics { Ratings = ratings },
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = covers,
Preview = preview,
PlayCount = playCount,
FavouriteCount = favouriteCount,
BPM = bpm,
Status = Status,
HasExplicitContent = hasExplicitContent,
HasVideo = hasVideo,
HasStoryboard = hasStoryboard,
Submitted = submitted,
Ranked = ranked,
LastUpdated = lastUpdated,
Availability = availability,
HasFavourited = hasFavourited,
Genre = genre,
Language = language,
TrackId = trackId
},
OnlineInfo = this
};
beatmapSet.Beatmaps = beatmaps?.Select(b =>