Merge branch 'master' into generic-download-model-manager

This commit is contained in:
Dean Herbert
2019-06-19 01:29:06 +09:00
committed by GitHub
29 changed files with 435 additions and 226 deletions

View File

@ -1,20 +0,0 @@
// 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.Beatmaps;
using osu.Game.Online.API.Requests.Responses;
namespace osu.Game.Online.API.Requests
{
public class GetBeatmapDetailsRequest : APIRequest<APIBeatmapMetrics>
{
private readonly BeatmapInfo beatmap;
public GetBeatmapDetailsRequest(BeatmapInfo beatmap)
{
this.beatmap = beatmap;
}
protected override string Target => $@"beatmaps/{beatmap.OnlineBeatmapID}";
}
}

View File

@ -57,6 +57,9 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"version")]
private string version { get; set; }
[JsonProperty(@"failtimes")]
private BeatmapMetrics metrics { get; set; }
public BeatmapInfo ToBeatmap(RulesetStore rulesets)
{
var set = BeatmapSet?.ToBeatmapSet(rulesets);
@ -70,6 +73,7 @@ namespace osu.Game.Online.API.Requests.Responses
Version = version,
Status = Status,
BeatmapSet = set,
Metrics = metrics,
BaseDifficulty = new BeatmapDifficulty
{
DrainRate = drainRate,

View File

@ -1,29 +0,0 @@
// 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 Newtonsoft.Json;
using osu.Game.Beatmaps;
namespace osu.Game.Online.API.Requests.Responses
{
public class APIBeatmapMetrics : BeatmapMetrics
{
//the online API returns some metrics as a nested object.
[JsonProperty(@"failtimes")]
private BeatmapMetrics failTimes
{
set
{
Fails = value.Fails;
Retries = value.Retries;
}
}
//and other metrics in the beatmap set.
[JsonProperty(@"beatmapset")]
private BeatmapMetrics beatmapSet
{
set => Ratings = value.Ratings;
}
}
}

View File

@ -54,6 +54,9 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"last_updated")]
private DateTimeOffset lastUpdated { get; set; }
[JsonProperty(@"ratings")]
private int[] ratings { get; set; }
[JsonProperty(@"user_id")]
private long creatorId
{
@ -70,6 +73,7 @@ namespace osu.Game.Online.API.Requests.Responses
OnlineBeatmapSetID = OnlineBeatmapSetID,
Metadata = this,
Status = Status,
Metrics = ratings == null ? null : new BeatmapSetMetrics { Ratings = ratings },
OnlineInfo = new BeatmapSetOnlineInfo
{
Covers = covers,

View File

@ -31,9 +31,9 @@ namespace osu.Game.Online.API.Requests.Responses
public List<APIChangelogEntry> ChangelogEntries { get; set; }
[JsonProperty("versions")]
public VersionNatigation Versions { get; set; }
public VersionNavigation Versions { get; set; }
public class VersionNatigation
public class VersionNavigation
{
[JsonProperty("next")]
public APIChangelogBuild Next { get; set; }

View File

@ -30,7 +30,10 @@ namespace osu.Game.Online.API.Requests
req.ContentType = "application/json";
req.Method = HttpMethod.Put;
req.AddRaw(JsonConvert.SerializeObject(scoreInfo));
req.AddRaw(JsonConvert.SerializeObject(scoreInfo, new JsonSerializerSettings
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
}));
return req;
}