2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-06-08 10:41:54 +08:00
|
|
|
|
using System;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
|
2018-06-08 10:41:54 +08:00
|
|
|
|
namespace osu.Game.Online.API.Requests.Responses
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
2018-06-08 10:41:54 +08:00
|
|
|
|
public class APIBeatmapSet : BeatmapMetadata // todo: this is a bit wrong...
|
2018-04-13 17:19:50 +08:00
|
|
|
|
{
|
|
|
|
|
[JsonProperty(@"covers")]
|
|
|
|
|
private BeatmapSetOnlineCovers covers { get; set; }
|
|
|
|
|
|
2018-06-08 11:46:34 +08:00
|
|
|
|
private int? onlineBeatmapSetID;
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"id")]
|
|
|
|
|
public int? OnlineBeatmapSetID
|
|
|
|
|
{
|
2018-09-13 17:57:33 +08:00
|
|
|
|
get => onlineBeatmapSetID;
|
|
|
|
|
set => onlineBeatmapSetID = value > 0 ? value : null;
|
2018-06-08 11:46:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-13 17:57:33 +08:00
|
|
|
|
[JsonProperty(@"status")]
|
|
|
|
|
public BeatmapSetOnlineStatus Status { get; set; }
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
[JsonProperty(@"preview_url")]
|
|
|
|
|
private string preview { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"play_count")]
|
|
|
|
|
private int playCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"favourite_count")]
|
|
|
|
|
private int favouriteCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"bpm")]
|
|
|
|
|
private double bpm { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"video")]
|
|
|
|
|
private bool hasVideo { get; set; }
|
|
|
|
|
|
2018-05-31 23:09:19 +08:00
|
|
|
|
[JsonProperty(@"storyboard")]
|
|
|
|
|
private bool hasStoryboard { get; set; }
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
[JsonProperty(@"submitted_date")]
|
|
|
|
|
private DateTimeOffset submitted { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"ranked_date")]
|
2018-07-03 14:57:05 +08:00
|
|
|
|
private DateTimeOffset? ranked { get; set; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
[JsonProperty(@"last_updated")]
|
|
|
|
|
private DateTimeOffset lastUpdated { get; set; }
|
|
|
|
|
|
2019-06-13 15:52:49 +08:00
|
|
|
|
[JsonProperty(@"ratings")]
|
|
|
|
|
private int[] ratings { get; set; }
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
[JsonProperty(@"user_id")]
|
2018-06-08 11:04:33 +08:00
|
|
|
|
private long creatorId
|
|
|
|
|
{
|
2018-09-13 17:57:33 +08:00
|
|
|
|
set => Author.Id = value;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
2019-06-10 18:18:38 +08:00
|
|
|
|
[JsonProperty(@"availability")]
|
|
|
|
|
private BeatmapSetOnlineAvailability availability { get; set; }
|
|
|
|
|
|
2018-04-13 17:19:50 +08:00
|
|
|
|
[JsonProperty(@"beatmaps")]
|
2018-06-08 11:04:33 +08:00
|
|
|
|
private IEnumerable<APIBeatmap> beatmaps { get; set; }
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
public BeatmapSetInfo ToBeatmapSet(RulesetStore rulesets)
|
|
|
|
|
{
|
|
|
|
|
return new BeatmapSetInfo
|
|
|
|
|
{
|
|
|
|
|
OnlineBeatmapSetID = OnlineBeatmapSetID,
|
|
|
|
|
Metadata = this,
|
2018-09-13 17:57:33 +08:00
|
|
|
|
Status = Status,
|
2019-06-13 18:14:58 +08:00
|
|
|
|
Metrics = ratings == null ? null : new BeatmapSetMetrics { Ratings = ratings },
|
2018-04-13 17:19:50 +08:00
|
|
|
|
OnlineInfo = new BeatmapSetOnlineInfo
|
|
|
|
|
{
|
|
|
|
|
Covers = covers,
|
|
|
|
|
Preview = preview,
|
|
|
|
|
PlayCount = playCount,
|
|
|
|
|
FavouriteCount = favouriteCount,
|
|
|
|
|
BPM = bpm,
|
2018-09-13 17:57:33 +08:00
|
|
|
|
Status = Status,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
HasVideo = hasVideo,
|
2018-05-31 23:09:19 +08:00
|
|
|
|
HasStoryboard = hasStoryboard,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
Submitted = submitted,
|
|
|
|
|
Ranked = ranked,
|
|
|
|
|
LastUpdated = lastUpdated,
|
2019-06-10 18:18:38 +08:00
|
|
|
|
Availability = availability,
|
2018-04-13 17:19:50 +08:00
|
|
|
|
},
|
|
|
|
|
Beatmaps = beatmaps?.Select(b => b.ToBeatmap(rulesets)).ToList(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|