Update tournament components to use APIBeatmap directly

This commit is contained in:
Dean Herbert
2021-10-27 17:22:23 +09:00
parent db6343c44c
commit 3130616300
16 changed files with 59 additions and 65 deletions

View File

@ -3,7 +3,6 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
@ -23,14 +22,13 @@ namespace osu.Game.Tournament.Tests.Components
[BackgroundDependencyLoader]
private void load()
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = 1091460 });
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = 1091460 });
req.Success += success;
api.Queue(req);
}
private void success(APIBeatmap apiBeatmap)
private void success(APIBeatmap beatmap)
{
var beatmap = apiBeatmap.ToBeatmapInfo(rulesets);
Add(new TournamentBeatmapPanel(beatmap)
{
Anchor = Anchor.Centre,

View File

@ -4,12 +4,12 @@
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Rulesets;
using osu.Game.Tournament.Components;
using osuTK;
namespace osu.Game.Tournament.Tests.Components
{
@ -23,12 +23,10 @@ namespace osu.Game.Tournament.Tests.Components
private FillFlowContainer<TournamentBeatmapPanel> fillFlow;
private BeatmapInfo beatmapInfo;
[BackgroundDependencyLoader]
private void load()
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = 490154 });
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = 490154 });
req.Success += success;
api.Queue(req);
@ -38,18 +36,17 @@ namespace osu.Game.Tournament.Tests.Components
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Direction = FillDirection.Full,
Spacing = new osuTK.Vector2(10)
Spacing = new Vector2(10)
});
}
private void success(APIBeatmap apiBeatmap)
private void success(APIBeatmap beatmap)
{
beatmapInfo = apiBeatmap.ToBeatmapInfo(rulesets);
var mods = rulesets.GetRuleset(Ladder.Ruleset.Value.ID ?? 0).CreateInstance().AllMods;
foreach (var mod in mods)
{
fillFlow.Add(new TournamentBeatmapPanel(beatmapInfo, mod.Acronym)
fillFlow.Add(new TournamentBeatmapPanel(beatmap, mod.Acronym)
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre