1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 07:33:20 +08:00

display RankBadges on on their sector centres

the D `RankBadge` does this anyway. the A and S badges are slightly off
centre to prevent overlap with the SS badge
This commit is contained in:
Walavouchey 2023-02-07 12:08:37 +01:00
parent 6ace6bfee1
commit 0531c010eb
2 changed files with 15 additions and 8 deletions

View File

@ -220,12 +220,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
Padding = new MarginPadding { Vertical = -15, Horizontal = -20 },
Children = new[]
{
new RankBadge(1, getRank(ScoreRank.X)),
new RankBadge(0.95, getRank(ScoreRank.S)),
new RankBadge(0.9, getRank(ScoreRank.A)),
new RankBadge(0.8, getRank(ScoreRank.B)),
new RankBadge(0.7, getRank(ScoreRank.C)),
new RankBadge(0.35, getRank(ScoreRank.D)),
new RankBadge(1, 1, getRank(ScoreRank.X)),
new RankBadge(0.95, 0.95 + (0.025 - virtual_ss_percentage) / 2, getRank(ScoreRank.S)),
new RankBadge(0.9, 0.9125, getRank(ScoreRank.A)),
new RankBadge(0.8, 0.85, getRank(ScoreRank.B)),
new RankBadge(0.7, 0.75, getRank(ScoreRank.C)),
new RankBadge(0, 0.35, getRank(ScoreRank.D)),
}
},
rankText = new RankText(score.Rank)

View File

@ -27,6 +27,11 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
/// </summary>
public readonly double Accuracy;
/// <summary>
/// The position around the <see cref="AccuracyCircle"/> to display this badge.
/// </summary>
private readonly double displayPosition;
private readonly ScoreRank rank;
private Drawable rankContainer;
@ -36,10 +41,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
/// Creates a new <see cref="RankBadge"/>.
/// </summary>
/// <param name="accuracy">The accuracy value corresponding to <paramref name="rank"/>.</param>
/// <param name="position">The position around the <see cref="AccuracyCircle"/> to display this badge.</param>
/// <param name="rank">The <see cref="ScoreRank"/> to be displayed in this <see cref="RankBadge"/>.</param>
public RankBadge(double accuracy, ScoreRank rank)
public RankBadge(double accuracy, double position, ScoreRank rank)
{
Accuracy = accuracy;
displayPosition = position;
this.rank = rank;
RelativeSizeAxes = Axes.Both;
@ -92,7 +99,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Accuracy
base.Update();
// Starts at -90deg (top) and moves counter-clockwise by the accuracy
rankContainer.Position = circlePosition(-MathF.PI / 2 - (1 - (float)Accuracy) * MathF.PI * 2);
rankContainer.Position = circlePosition(-MathF.PI / 2 - (1 - (float)displayPosition) * MathF.PI * 2);
}
private Vector2 circlePosition(float t)