2024-01-29 10:14:24 +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.
|
|
|
|
|
2024-01-29 11:13:52 +08:00
|
|
|
using System;
|
2024-01-29 10:14:24 +08:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.UserInterface;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|
|
|
{
|
2024-01-29 11:13:52 +08:00
|
|
|
public partial class GradedCircles : CompositeDrawable
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
2024-01-29 11:13:52 +08:00
|
|
|
private double progress;
|
|
|
|
|
2024-01-29 10:29:29 +08:00
|
|
|
public double Progress
|
|
|
|
{
|
2024-01-29 11:13:52 +08:00
|
|
|
get => progress;
|
|
|
|
set
|
|
|
|
{
|
|
|
|
progress = value;
|
|
|
|
dProgress.RevealProgress = value;
|
|
|
|
cProgress.RevealProgress = value;
|
|
|
|
bProgress.RevealProgress = value;
|
|
|
|
aProgress.RevealProgress = value;
|
|
|
|
sProgress.RevealProgress = value;
|
|
|
|
xProgress.RevealProgress = value;
|
|
|
|
}
|
2024-01-29 10:29:29 +08:00
|
|
|
}
|
|
|
|
|
2024-01-29 11:13:52 +08:00
|
|
|
private readonly GradedCircle dProgress;
|
|
|
|
private readonly GradedCircle cProgress;
|
|
|
|
private readonly GradedCircle bProgress;
|
|
|
|
private readonly GradedCircle aProgress;
|
|
|
|
private readonly GradedCircle sProgress;
|
|
|
|
private readonly GradedCircle xProgress;
|
2024-01-29 10:14:24 +08:00
|
|
|
|
|
|
|
public GradedCircles(double accuracyC, double accuracyB, double accuracyA, double accuracyS, double accuracyX)
|
|
|
|
{
|
2024-01-29 11:13:52 +08:00
|
|
|
InternalChildren = new Drawable[]
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
2024-01-29 11:13:52 +08:00
|
|
|
dProgress = new GradedCircle(0.0, accuracyC)
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
|
|
|
Colour = OsuColour.ForRank(ScoreRank.D),
|
|
|
|
},
|
2024-01-29 11:13:52 +08:00
|
|
|
cProgress = new GradedCircle(accuracyC, accuracyB)
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
|
|
|
Colour = OsuColour.ForRank(ScoreRank.C),
|
|
|
|
},
|
2024-01-29 11:13:52 +08:00
|
|
|
bProgress = new GradedCircle(accuracyB, accuracyA)
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
|
|
|
Colour = OsuColour.ForRank(ScoreRank.B),
|
|
|
|
},
|
2024-01-29 11:13:52 +08:00
|
|
|
aProgress = new GradedCircle(accuracyA, accuracyS)
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
|
|
|
Colour = OsuColour.ForRank(ScoreRank.A),
|
|
|
|
},
|
2024-01-29 11:13:52 +08:00
|
|
|
sProgress = new GradedCircle(accuracyS, accuracyX - AccuracyCircle.VIRTUAL_SS_PERCENTAGE)
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
|
|
|
Colour = OsuColour.ForRank(ScoreRank.S),
|
|
|
|
},
|
2024-01-29 11:13:52 +08:00
|
|
|
xProgress = new GradedCircle(accuracyX - AccuracyCircle.VIRTUAL_SS_PERCENTAGE, 1.0)
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
2024-01-29 11:13:52 +08:00
|
|
|
Colour = OsuColour.ForRank(ScoreRank.X)
|
2024-01-29 10:14:24 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2024-01-29 11:13:52 +08:00
|
|
|
private partial class GradedCircle : CircularProgress
|
2024-01-29 10:14:24 +08:00
|
|
|
{
|
2024-01-29 11:13:52 +08:00
|
|
|
public double RevealProgress
|
|
|
|
{
|
|
|
|
set => Current.Value = Math.Clamp(value, startProgress, endProgress) - startProgress;
|
|
|
|
}
|
|
|
|
|
|
|
|
private readonly double startProgress;
|
|
|
|
private readonly double endProgress;
|
|
|
|
|
|
|
|
public GradedCircle(double startProgress, double endProgress)
|
|
|
|
{
|
2024-02-04 08:02:39 +08:00
|
|
|
this.startProgress = startProgress + AccuracyCircle.GRADE_SPACING_PERCENTAGE * 0.5;
|
|
|
|
this.endProgress = endProgress - AccuracyCircle.GRADE_SPACING_PERCENTAGE * 0.5;
|
2024-01-29 11:13:52 +08:00
|
|
|
|
|
|
|
Anchor = Anchor.Centre;
|
|
|
|
Origin = Anchor.Centre;
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
InnerRadius = AccuracyCircle.RANK_CIRCLE_RADIUS;
|
|
|
|
Rotation = (float)this.startProgress * 360;
|
|
|
|
}
|
2024-01-29 10:14:24 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|