2021-01-25 21:20:58 +08:00
|
|
|
// 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.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
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;
|
2022-06-18 06:34:09 +08:00
|
|
|
using osu.Game.Tournament.Models;
|
2021-10-27 16:22:23 +08:00
|
|
|
using osuTK;
|
2021-01-25 21:20:58 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Tournament.Tests.Components
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
public partial class TestSceneTournamentModDisplay : TournamentTestScene
|
2021-01-25 21:20:58 +08:00
|
|
|
{
|
|
|
|
[Resolved]
|
2023-08-10 03:32:46 +08:00
|
|
|
private IAPIProvider api { get; set; } = null!;
|
2021-01-25 21:20:58 +08:00
|
|
|
|
|
|
|
[Resolved]
|
2023-08-10 03:32:46 +08:00
|
|
|
private IRulesetStore rulesets { get; set; } = null!;
|
2021-01-25 21:20:58 +08:00
|
|
|
|
2023-08-10 03:32:46 +08:00
|
|
|
private FillFlowContainer<TournamentBeatmapPanel> fillFlow = null!;
|
2021-01-25 21:20:58 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2021-10-27 16:22:23 +08:00
|
|
|
var req = new GetBeatmapRequest(new APIBeatmap { OnlineID = 490154 });
|
2021-01-25 21:20:58 +08:00
|
|
|
req.Success += success;
|
|
|
|
api.Queue(req);
|
|
|
|
|
|
|
|
Add(fillFlow = new FillFlowContainer<TournamentBeatmapPanel>
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Direction = FillDirection.Full,
|
2021-10-27 16:22:23 +08:00
|
|
|
Spacing = new Vector2(10)
|
2021-01-25 21:20:58 +08:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-10-27 16:22:23 +08:00
|
|
|
private void success(APIBeatmap beatmap)
|
2021-01-25 21:20:58 +08:00
|
|
|
{
|
2023-07-30 01:56:52 +08:00
|
|
|
var ruleset = rulesets.GetRuleset(Ladder.Ruleset.Value?.OnlineID ?? -1);
|
2021-11-22 15:08:42 +08:00
|
|
|
|
|
|
|
if (ruleset == null)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var mods = ruleset.CreateInstance().AllMods;
|
2021-01-25 21:20:58 +08:00
|
|
|
|
|
|
|
foreach (var mod in mods)
|
|
|
|
{
|
2022-06-18 06:34:09 +08:00
|
|
|
fillFlow.Add(new TournamentBeatmapPanel(new TournamentBeatmap(beatmap), mod.Acronym)
|
2021-01-25 21:21:22 +08:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre
|
|
|
|
});
|
2021-01-25 21:20:58 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|