replace BeatmapResponse with BeatmapInfo

This commit is contained in:
jorolf
2017-11-24 22:48:56 +01:00
parent 57f2d8556b
commit 21d5d10738
3 changed files with 7 additions and 28 deletions

View File

@ -17,7 +17,7 @@ namespace osu.Game.Tests.Visual
{ {
public override string Description => "User's History"; public override string Description => "User's History";
public override IReadOnlyList<Type> RequiredTypes => new [] { typeof(HistoricalSection), typeof(MostPlayedBeatmapDrawable)}; public override IReadOnlyList<Type> RequiredTypes => new [] { typeof(HistoricalSection), typeof(PaginatedMostPlayedBeatmapContainer), typeof(MostPlayedBeatmapDrawable) };
public TestCaseHistoricalSection() public TestCaseHistoricalSection()

View File

@ -115,6 +115,7 @@ namespace osu.Game.Beatmaps
// Metadata // Metadata
public string Version { get; set; } public string Version { get; set; }
[JsonProperty("difficulty_rating")]
public double StarDifficulty { get; set; } public double StarDifficulty { get; set; }
public bool Equals(BeatmapInfo other) public bool Equals(BeatmapInfo other)

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.Linq;
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets; using osu.Game.Rulesets;
@ -28,7 +27,7 @@ namespace osu.Game.Online.API.Requests
public int PlayCount; public int PlayCount;
[JsonProperty] [JsonProperty]
private BeatmapResponse beatmap; private BeatmapInfo beatmap;
[JsonProperty] [JsonProperty]
private GetBeatmapSetsResponse beatmapSet; private GetBeatmapSetsResponse beatmapSet;
@ -36,31 +35,10 @@ namespace osu.Game.Online.API.Requests
public BeatmapInfo GetBeatmapInfo(RulesetStore rulesets) public BeatmapInfo GetBeatmapInfo(RulesetStore rulesets)
{ {
BeatmapSetInfo setInfo = beatmapSet.ToBeatmapSet(rulesets); BeatmapSetInfo setInfo = beatmapSet.ToBeatmapSet(rulesets);
return new BeatmapInfo beatmap.BeatmapSet = setInfo;
{ beatmap.OnlineBeatmapSetID = setInfo.OnlineBeatmapSetID;
OnlineBeatmapID = beatmap.Id, beatmap.Metadata = setInfo.Metadata;
OnlineBeatmapSetID = setInfo.OnlineBeatmapSetID, return beatmap;
Ruleset = rulesets.AvailableRulesets.FirstOrDefault(ruleset => ruleset.Name.Equals(beatmap.Mode)),
StarDifficulty = beatmap.DifficultyRating,
Version = beatmap.Version,
Metadata = setInfo.Metadata,
BeatmapSet = setInfo,
};
}
private class BeatmapResponse
{
[JsonProperty]
public int Id;
[JsonProperty]
public string Mode;
[JsonProperty("difficulty_rating")]
public double DifficultyRating;
[JsonProperty]
public string Version;
} }
} }
} }