2017-05-28 13:26:25 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using Newtonsoft.Json;
|
2017-07-26 12:22:46 +08:00
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets;
|
2017-11-10 08:01:11 +08:00
|
|
|
|
using System;
|
2017-05-28 13:26:25 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
|
{
|
2017-10-25 18:26:46 +08:00
|
|
|
|
public class GetBeatmapSetsResponse : BeatmapMetadata // todo: this is a bit wrong...
|
2017-05-28 13:26:25 +08:00
|
|
|
|
{
|
|
|
|
|
[JsonProperty(@"covers")]
|
|
|
|
|
private BeatmapSetOnlineCovers covers { get; set; }
|
|
|
|
|
|
2017-11-15 12:15:20 +08:00
|
|
|
|
[JsonProperty(@"preview_url")]
|
2017-05-28 13:26:25 +08:00
|
|
|
|
private string preview { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"play_count")]
|
|
|
|
|
private int playCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"favourite_count")]
|
|
|
|
|
private int favouriteCount { get; set; }
|
|
|
|
|
|
2017-11-10 08:01:11 +08:00
|
|
|
|
[JsonProperty(@"bpm")]
|
|
|
|
|
private double bpm { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"video")]
|
|
|
|
|
private bool hasVideo { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"submitted_date")]
|
|
|
|
|
private DateTimeOffset submitted { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"ranked_date")]
|
|
|
|
|
private DateTimeOffset ranked { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"last_updated")]
|
|
|
|
|
private DateTimeOffset lastUpdated { get; set; }
|
|
|
|
|
|
2017-09-25 23:34:56 +08:00
|
|
|
|
[JsonProperty(@"user_id")]
|
2017-10-13 19:25:27 +08:00
|
|
|
|
private long creatorId {
|
|
|
|
|
set { Author.Id = value; }
|
|
|
|
|
}
|
2017-09-25 23:34:56 +08:00
|
|
|
|
|
2017-05-28 13:26:25 +08:00
|
|
|
|
[JsonProperty(@"beatmaps")]
|
|
|
|
|
private IEnumerable<GetBeatmapSetsBeatmapResponse> beatmaps { get; set; }
|
|
|
|
|
|
2017-07-27 15:56:41 +08:00
|
|
|
|
public BeatmapSetInfo ToBeatmapSet(RulesetStore rulesets)
|
2017-05-28 13:26:25 +08:00
|
|
|
|
{
|
|
|
|
|
return new BeatmapSetInfo
|
|
|
|
|
{
|
2017-10-25 18:26:46 +08:00
|
|
|
|
OnlineBeatmapSetID = OnlineBeatmapSetID,
|
2017-05-28 13:26:25 +08:00
|
|
|
|
Metadata = this,
|
|
|
|
|
OnlineInfo = new BeatmapSetOnlineInfo
|
|
|
|
|
{
|
|
|
|
|
Covers = covers,
|
|
|
|
|
Preview = preview,
|
|
|
|
|
PlayCount = playCount,
|
|
|
|
|
FavouriteCount = favouriteCount,
|
2017-11-10 08:01:11 +08:00
|
|
|
|
BPM = bpm,
|
|
|
|
|
HasVideo = hasVideo,
|
|
|
|
|
Submitted = submitted,
|
|
|
|
|
Ranked = ranked,
|
|
|
|
|
LastUpdated = lastUpdated,
|
2017-05-28 13:26:25 +08:00
|
|
|
|
},
|
|
|
|
|
Beatmaps = beatmaps.Select(b => b.ToBeatmap(rulesets)).ToList(),
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private class GetBeatmapSetsBeatmapResponse : BeatmapMetadata
|
|
|
|
|
{
|
2017-11-11 06:51:42 +08:00
|
|
|
|
[JsonProperty(@"id")]
|
|
|
|
|
private int onlineBeatmapID { get; set; }
|
|
|
|
|
|
2017-05-28 13:26:25 +08:00
|
|
|
|
[JsonProperty(@"playcount")]
|
|
|
|
|
private int playCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"passcount")]
|
|
|
|
|
private int passCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"mode_int")]
|
|
|
|
|
private int ruleset { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"difficulty_rating")]
|
|
|
|
|
private double starDifficulty { get; set; }
|
|
|
|
|
|
2017-11-10 08:01:11 +08:00
|
|
|
|
[JsonProperty(@"drain")]
|
|
|
|
|
private float drainRate { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"cs")]
|
|
|
|
|
private float circleSize { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"ar")]
|
|
|
|
|
private float approachRate { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"accuracy")]
|
|
|
|
|
private float overallDifficulty { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"total_length")]
|
|
|
|
|
private double length { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"count_circles")]
|
|
|
|
|
private int circleCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"count_sliders")]
|
|
|
|
|
private int sliderCount { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonProperty(@"version")]
|
|
|
|
|
private string version { get; set; }
|
|
|
|
|
|
2017-07-27 15:56:41 +08:00
|
|
|
|
public BeatmapInfo ToBeatmap(RulesetStore rulesets)
|
2017-05-28 13:26:25 +08:00
|
|
|
|
{
|
|
|
|
|
return new BeatmapInfo
|
|
|
|
|
{
|
|
|
|
|
Metadata = this,
|
|
|
|
|
Ruleset = rulesets.GetRuleset(ruleset),
|
|
|
|
|
StarDifficulty = starDifficulty,
|
2017-11-11 06:51:42 +08:00
|
|
|
|
OnlineBeatmapID = onlineBeatmapID,
|
2017-11-10 08:01:11 +08:00
|
|
|
|
Version = version,
|
|
|
|
|
BaseDifficulty = new BeatmapDifficulty
|
|
|
|
|
{
|
|
|
|
|
DrainRate = drainRate,
|
|
|
|
|
CircleSize = circleSize,
|
|
|
|
|
ApproachRate = approachRate,
|
|
|
|
|
OverallDifficulty = overallDifficulty,
|
|
|
|
|
},
|
2017-05-28 13:26:25 +08:00
|
|
|
|
OnlineInfo = new BeatmapOnlineInfo
|
|
|
|
|
{
|
|
|
|
|
PlayCount = playCount,
|
|
|
|
|
PassCount = passCount,
|
2017-11-10 08:01:11 +08:00
|
|
|
|
Length = length,
|
|
|
|
|
CircleCount = circleCount,
|
|
|
|
|
SliderCount = sliderCount,
|
2017-05-28 13:26:25 +08:00
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|