1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 14:13:18 +08:00

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 IReadOnlyList<Type> RequiredTypes => new [] { typeof(HistoricalSection), typeof(MostPlayedBeatmapDrawable)};
public override IReadOnlyList<Type> RequiredTypes => new [] { typeof(HistoricalSection), typeof(PaginatedMostPlayedBeatmapContainer), typeof(MostPlayedBeatmapDrawable) };
public TestCaseHistoricalSection()

View File

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

View File

@ -2,7 +2,6 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Linq;
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
@ -28,7 +27,7 @@ namespace osu.Game.Online.API.Requests
public int PlayCount;
[JsonProperty]
private BeatmapResponse beatmap;
private BeatmapInfo beatmap;
[JsonProperty]
private GetBeatmapSetsResponse beatmapSet;
@ -36,31 +35,10 @@ namespace osu.Game.Online.API.Requests
public BeatmapInfo GetBeatmapInfo(RulesetStore rulesets)
{
BeatmapSetInfo setInfo = beatmapSet.ToBeatmapSet(rulesets);
return new BeatmapInfo
{
OnlineBeatmapID = beatmap.Id,
OnlineBeatmapSetID = setInfo.OnlineBeatmapSetID,
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;
beatmap.BeatmapSet = setInfo;
beatmap.OnlineBeatmapSetID = setInfo.OnlineBeatmapSetID;
beatmap.Metadata = setInfo.Metadata;
return beatmap;
}
}
}