Refactor BeatmapMetadataContainer and usages to use interface types

This commit is contained in:
Dean Herbert
2021-10-22 21:25:13 +09:00
parent 28d8820976
commit c701579c69
5 changed files with 86 additions and 61 deletions

View File

@ -2,8 +2,6 @@
// See the LICENCE file in the repository root for full licence text.
using Newtonsoft.Json;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
namespace osu.Game.Online.API.Requests.Responses
{
@ -16,17 +14,19 @@ namespace osu.Game.Online.API.Requests.Responses
public int PlayCount { get; set; }
[JsonProperty("beatmap")]
private BeatmapInfo beatmapInfo { get; set; }
private APIBeatmap beatmap { get; set; }
[JsonProperty]
private APIBeatmapSet beatmapSet { get; set; }
public BeatmapInfo GetBeatmapInfo(RulesetStore rulesets)
public APIBeatmap BeatmapInfo
{
BeatmapSetInfo setInfo = beatmapSet.ToBeatmapSet(rulesets);
beatmapInfo.BeatmapSet = setInfo;
beatmapInfo.Metadata = setInfo.Metadata;
return beatmapInfo;
get
{
// old osu-web code doesn't nest set.
beatmap.BeatmapSet = BeatmapSet;
return beatmap;
}
}
[JsonProperty("beatmapset")]
public APIBeatmapSet BeatmapSet { get; set; }
}
}