Adjust results screen to handle S->A rank adjustment when misses are present

This commit is contained in:
Dean Herbert 2024-01-22 21:31:17 +09:00
parent 644e7d6fe6
commit 83f9118b22
No known key found for this signature in database
3 changed files with 55 additions and 13 deletions

View File

@ -21,6 +21,7 @@ using osu.Game.Online.API;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Difficulty;
using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Screens;
using osu.Game.Screens.Play;
@ -71,15 +72,16 @@ namespace osu.Game.Tests.Visual.Ranking
private int onlineScoreID = 1;
[TestCase(1, ScoreRank.X)]
[TestCase(0.9999, ScoreRank.S)]
[TestCase(0.975, ScoreRank.S)]
[TestCase(0.925, ScoreRank.A)]
[TestCase(0.85, ScoreRank.B)]
[TestCase(0.75, ScoreRank.C)]
[TestCase(0.5, ScoreRank.D)]
[TestCase(0.2, ScoreRank.D)]
public void TestResultsWithPlayer(double accuracy, ScoreRank rank)
[TestCase(1, ScoreRank.X, 0)]
[TestCase(0.9999, ScoreRank.S, 0)]
[TestCase(0.975, ScoreRank.S, 0)]
[TestCase(0.975, ScoreRank.A, 1)]
[TestCase(0.925, ScoreRank.A, 5)]
[TestCase(0.85, ScoreRank.B, 9)]
[TestCase(0.75, ScoreRank.C, 11)]
[TestCase(0.5, ScoreRank.D, 21)]
[TestCase(0.2, ScoreRank.D, 51)]
public void TestResultsWithPlayer(double accuracy, ScoreRank rank, int missCount)
{
TestResultsScreen screen = null;
@ -91,6 +93,7 @@ namespace osu.Game.Tests.Visual.Ranking
score.HitEvents = TestSceneStatisticsPanel.CreatePositionDistributedHitEvents();
score.Accuracy = accuracy;
score.Rank = rank;
score.Statistics[HitResult.Miss] = missCount;
return screen = createResultsScreen(score);
});

View File

@ -21,6 +21,7 @@ using osu.Game.Rulesets.Scoring;
using osu.Game.Scoring;
using osu.Game.Skinning;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Ranking.Expanded.Accuracy
{
@ -111,6 +112,9 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
private readonly double accuracyD;
private readonly bool withFlair;
private readonly bool isFailedSDueToMisses;
private RankText failedSRankText;
public AccuracyCircle(ScoreInfo score, bool withFlair = false)
{
this.score = score;
@ -119,10 +123,17 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
ScoreProcessor scoreProcessor = score.Ruleset.CreateInstance().CreateScoreProcessor();
accuracyX = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.X);
accuracyS = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.S);
// Some rulesets require no misses to get an S rank.
// if (score.Accuracy >= accuracyS && score.Rank == ScoreRank.A)
// accuracyS = score.Accuracy + 0.0001;
accuracyA = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.A);
accuracyB = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.B);
accuracyC = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.C);
accuracyD = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.D);
isFailedSDueToMisses = score.Accuracy >= accuracyS && score.Rank == ScoreRank.A;
}
[BackgroundDependencyLoader]
@ -249,6 +260,9 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
if (withFlair)
{
if (isFailedSDueToMisses)
AddInternal(failedSRankText = new RankText(ScoreRank.S));
AddRangeInternal(new Drawable[]
{
rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)),
@ -387,6 +401,31 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
});
}
}
if (isFailedSDueToMisses)
{
const double adjust_duration = 200;
using (BeginDelayedSequence(TEXT_APPEAR_DELAY - adjust_duration))
{
failedSRankText.FadeIn(adjust_duration);
using (BeginDelayedSequence(adjust_duration))
{
failedSRankText
.FadeColour(Color4.Red, 800, Easing.Out)
.RotateTo(10, 1000, Easing.Out)
.MoveToY(100, 1000, Easing.In)
.FadeOut(800, Easing.Out);
accuracyCircle
.FillTo(accuracyS - 0.0001, 70, Easing.OutQuint);
badges.Single(b => b.Rank == ScoreRank.S)
.FadeOut(70, Easing.OutQuint);
}
}
}
}
}

View File

@ -32,7 +32,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
/// </summary>
private readonly double displayPosition;
private readonly ScoreRank rank;
public readonly ScoreRank Rank;
private Drawable rankContainer;
private Drawable overlay;
@ -47,7 +47,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
{
Accuracy = accuracy;
displayPosition = position;
this.rank = rank;
Rank = rank;
RelativeSizeAxes = Axes.Both;
Alpha = 0;
@ -62,7 +62,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
Size = new Vector2(28, 14),
Children = new[]
{
new DrawableRank(rank),
new DrawableRank(Rank),
overlay = new CircularContainer
{
RelativeSizeAxes = Axes.Both,
@ -71,7 +71,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Glow,
Colour = OsuColour.ForRank(rank).Opacity(0.2f),
Colour = OsuColour.ForRank(Rank).Opacity(0.2f),
Radius = 10,
},
Child = new Box