1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-30 22:37:32 +08:00
osu-lazer/osu.Game.Tests/Visual/Online/TestSceneUserProfileScores.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

142 lines
5.0 KiB
C#
Raw Normal View History

2020-01-18 07:58:10 +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.
2022-06-17 15:37:17 +08:00
#nullable disable
2020-01-18 07:58:10 +08:00
using System;
using osu.Framework.Allocation;
2020-01-18 07:58:10 +08:00
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
2020-01-27 17:55:19 +08:00
using osu.Game.Overlays;
using osu.Game.Overlays.Profile.Sections.Ranks;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Scoring;
using osuTK;
2020-01-18 07:58:10 +08:00
namespace osu.Game.Tests.Visual.Online
{
public class TestSceneUserProfileScores : OsuTestScene
{
public TestSceneUserProfileScores()
{
var firstScore = new SoloScoreInfo
{
PP = 1047.21,
Rank = ScoreRank.SH,
BeatmapID = 2058788,
EndedAt = DateTimeOffset.Now,
Mods = new[]
{
new APIMod { Acronym = new OsuModHidden().Acronym },
new APIMod { Acronym = new OsuModHardRock().Acronym },
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
},
Accuracy = 0.9813
};
var firstBeatmap = new APIBeatmap
{
BeatmapSet = new APIBeatmapSet()
{
Title = "JUSTadICE (TV Size)",
Artist = "Oomori Seiko",
},
DifficultyName = "Extreme"
};
var secondScore = new SoloScoreInfo
2020-01-18 07:58:10 +08:00
{
PP = 134.32,
Rank = ScoreRank.A,
BeatmapID = 767046,
EndedAt = DateTimeOffset.Now,
Mods = new[]
2020-01-18 07:58:10 +08:00
{
new APIMod { Acronym = new OsuModHardRock().Acronym },
new APIMod { Acronym = new OsuModDoubleTime().Acronym },
2020-01-18 07:58:10 +08:00
},
Accuracy = 0.998546
};
var secondBeatmap = new APIBeatmap
{
BeatmapSet = new APIBeatmapSet()
{
Title = "Triumph & Regret",
Artist = "typeMARS",
},
DifficultyName = "[4K] Regret"
};
2020-01-18 07:58:10 +08:00
var thirdScore = new SoloScoreInfo
{
PP = 96.83,
Rank = ScoreRank.S,
BeatmapID = 2134713,
EndedAt = DateTimeOffset.Now,
Accuracy = 0.9726
};
var thirdBeatmap = new APIBeatmap
{
BeatmapSet = new APIBeatmapSet()
{
Title = "Idolize",
Artist = "Creo",
},
DifficultyName = "Insane"
};
var noPPScore = new SoloScoreInfo
2020-01-18 07:58:10 +08:00
{
Rank = ScoreRank.B,
BeatmapID = 992512,
EndedAt = DateTimeOffset.Now,
Accuracy = 0.55879
};
var noPPBeatmap = new APIBeatmap
{
BeatmapSet = new APIBeatmapSet()
2020-01-18 07:58:10 +08:00
{
Title = "Galaxy Collapse",
Artist = "Kurokotei",
2020-01-18 07:58:10 +08:00
},
DifficultyName = "[4K] Cataclysmic Hypernova"
2020-01-18 07:58:10 +08:00
};
Add(new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical,
Spacing = new Vector2(0, 10),
Children = new[]
{
new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(firstScore, firstBeatmap)),
new ColourProvidedContainer(OverlayColourScheme.Green, new DrawableProfileScore(secondScore, secondBeatmap)),
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileScore(noPPScore, noPPBeatmap)),
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(firstScore, firstBeatmap, 0.97)),
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(secondScore, secondBeatmap, 0.85)),
new ColourProvidedContainer(OverlayColourScheme.Pink, new DrawableProfileWeightedScore(thirdScore, thirdBeatmap, 0.66)),
2020-01-18 07:58:10 +08:00
}
});
}
2020-01-27 17:55:19 +08:00
private class ColourProvidedContainer : Container
{
[Cached]
private readonly OverlayColourProvider colourProvider;
public ColourProvidedContainer(OverlayColourScheme colourScheme, DrawableProfileScore score)
{
colourProvider = new OverlayColourProvider(colourScheme);
AutoSizeAxes = Axes.Y;
RelativeSizeAxes = Axes.X;
Add(score);
}
}
2020-01-18 07:58:10 +08:00
}
}