2023-06-23 00:37:25 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
2020-03-17 15:37:56 +08:00
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using NUnit.Framework;
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2021-11-04 17:02:44 +08:00
|
|
|
|
using osu.Game.Online.API.Requests.Responses;
|
2023-11-29 18:05:24 +08:00
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
using osu.Game.Rulesets.Catch;
|
2020-03-17 15:37:56 +08:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
using osu.Game.Rulesets.Osu;
|
|
|
|
|
using osu.Game.Rulesets.Osu.Mods;
|
|
|
|
|
using osu.Game.Rulesets.Scoring;
|
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
|
using osu.Game.Screens.Ranking.Expanded.Accuracy;
|
|
|
|
|
using osu.Game.Tests.Beatmaps;
|
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual.Ranking
|
|
|
|
|
{
|
2022-11-24 13:32:20 +08:00
|
|
|
|
public partial class TestSceneAccuracyCircle : OsuTestScene
|
2020-03-17 15:37:56 +08:00
|
|
|
|
{
|
2023-11-29 18:05:24 +08:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestOsuRank()
|
2020-03-19 10:58:52 +08:00
|
|
|
|
{
|
2023-11-29 18:05:24 +08:00
|
|
|
|
addCircleStep(createScore(0, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.5, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.699, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.7, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.75, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.799, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.8, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.85, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.899, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.9, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.925, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.9499, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.95, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.975, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.99, new OsuRuleset()));
|
|
|
|
|
addCircleStep(createScore(1, new OsuRuleset()));
|
|
|
|
|
}
|
2020-03-17 15:37:56 +08:00
|
|
|
|
|
2023-11-29 18:05:24 +08:00
|
|
|
|
[Test]
|
|
|
|
|
public void TestCatchRank()
|
|
|
|
|
{
|
|
|
|
|
addCircleStep(createScore(0, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.5, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.8499, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.85, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.875, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.899, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.9, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.925, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.9399, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.94, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.9675, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.9799, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.98, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(0.99, new CatchRuleset()));
|
|
|
|
|
addCircleStep(createScore(1, new CatchRuleset()));
|
2020-03-17 15:37:56 +08:00
|
|
|
|
}
|
|
|
|
|
|
2023-11-29 18:05:24 +08:00
|
|
|
|
private void addCircleStep(ScoreInfo score) => AddStep($"add panel ({score.DisplayAccuracy})", () =>
|
2020-03-17 15:37:56 +08:00
|
|
|
|
{
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Container
|
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Size = new Vector2(500, 700),
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
new Box
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("#555"), Color4Extensions.FromHex("#333"))
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
},
|
2021-05-27 14:04:22 +08:00
|
|
|
|
new AccuracyCircle(score, true)
|
2020-03-17 15:37:56 +08:00
|
|
|
|
{
|
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
|
Size = new Vector2(230)
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
});
|
|
|
|
|
|
2023-11-29 18:05:24 +08:00
|
|
|
|
private ScoreInfo createScore(double accuracy, Ruleset ruleset)
|
2020-03-17 15:37:56 +08:00
|
|
|
|
{
|
2023-11-29 18:05:24 +08:00
|
|
|
|
var scoreProcessor = ruleset.CreateScoreProcessor();
|
|
|
|
|
|
|
|
|
|
return new ScoreInfo
|
2020-03-17 15:37:56 +08:00
|
|
|
|
{
|
2023-11-29 18:05:24 +08:00
|
|
|
|
User = new APIUser
|
|
|
|
|
{
|
|
|
|
|
Id = 2,
|
|
|
|
|
Username = "peppy",
|
|
|
|
|
},
|
|
|
|
|
BeatmapInfo = new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo,
|
|
|
|
|
Ruleset = ruleset.RulesetInfo,
|
|
|
|
|
Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
|
|
|
|
|
TotalScore = 2845370,
|
|
|
|
|
Accuracy = accuracy,
|
|
|
|
|
MaxCombo = 999,
|
|
|
|
|
Rank = scoreProcessor.RankFromAccuracy(accuracy),
|
|
|
|
|
Date = DateTimeOffset.Now,
|
|
|
|
|
Statistics =
|
|
|
|
|
{
|
|
|
|
|
{ HitResult.Miss, 1 },
|
|
|
|
|
{ HitResult.Meh, 50 },
|
|
|
|
|
{ HitResult.Good, 100 },
|
|
|
|
|
{ HitResult.Great, 300 },
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-03-17 15:37:56 +08:00
|
|
|
|
}
|
|
|
|
|
}
|