2020-03-17 15:37:56 +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-03-17 15:37:56 +08:00
|
|
|
using System;
|
2020-07-02 08:37:38 +08:00
|
|
|
using System.Linq;
|
2020-03-17 15:37:56 +08:00
|
|
|
using osu.Framework.Allocation;
|
2020-10-29 15:11:37 +08:00
|
|
|
using osu.Framework.Audio;
|
2021-05-27 14:04:22 +08:00
|
|
|
using osu.Framework.Bindables;
|
2020-03-17 15:37:56 +08:00
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Colour;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2022-12-03 21:39:44 +08:00
|
|
|
using osu.Framework.Graphics.UserInterface;
|
2020-03-17 15:37:56 +08:00
|
|
|
using osu.Framework.Utils;
|
2021-06-09 17:15:45 +08:00
|
|
|
using osu.Game.Audio;
|
2020-03-17 15:37:56 +08:00
|
|
|
using osu.Game.Graphics;
|
2020-07-02 08:37:38 +08:00
|
|
|
using osu.Game.Rulesets.Mods;
|
2023-02-09 14:41:45 +08:00
|
|
|
using osu.Game.Rulesets.Scoring;
|
2020-03-17 15:37:56 +08:00
|
|
|
using osu.Game.Scoring;
|
2021-05-28 18:27:55 +08:00
|
|
|
using osu.Game.Skinning;
|
2024-02-04 07:58:15 +08:00
|
|
|
using osuTK;
|
2024-01-22 20:31:17 +08:00
|
|
|
using osuTK.Graphics;
|
2020-03-17 15:37:56 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Ranking.Expanded.Accuracy
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// The component that displays the player's accuracy on the results screen.
|
|
|
|
/// </summary>
|
|
|
|
public partial class AccuracyCircle : CompositeDrawable
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Duration for the transforms causing this component to appear.
|
|
|
|
/// </summary>
|
|
|
|
public const double APPEAR_DURATION = 200;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Delay before the accuracy circle starts filling.
|
|
|
|
/// </summary>
|
|
|
|
public const double ACCURACY_TRANSFORM_DELAY = 450;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Duration for the accuracy circle fill.
|
|
|
|
/// </summary>
|
|
|
|
public const double ACCURACY_TRANSFORM_DURATION = 3000;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Delay after <see cref="ACCURACY_TRANSFORM_DURATION"/> for the rank text (A/B/C/D/S/SS) to appear.
|
|
|
|
/// </summary>
|
|
|
|
public const double TEXT_APPEAR_DELAY = ACCURACY_TRANSFORM_DURATION / 2;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Delay before the rank circles start filling.
|
|
|
|
/// </summary>
|
|
|
|
public const double RANK_CIRCLE_TRANSFORM_DELAY = 150;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Duration for the rank circle fills.
|
|
|
|
/// </summary>
|
|
|
|
public const double RANK_CIRCLE_TRANSFORM_DURATION = 800;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Relative width of the rank circles.
|
|
|
|
/// </summary>
|
2024-01-29 11:28:38 +08:00
|
|
|
public const float RANK_CIRCLE_RADIUS = 0.05f;
|
2020-03-17 15:37:56 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Relative width of the circle showing the accuracy.
|
|
|
|
/// </summary>
|
|
|
|
private const float accuracy_circle_radius = 0.2f;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// SS is displayed as a 1% region, otherwise it would be invisible.
|
|
|
|
/// </summary>
|
2024-01-29 10:14:24 +08:00
|
|
|
public const double VIRTUAL_SS_PERCENTAGE = 0.01;
|
2020-03-17 15:37:56 +08:00
|
|
|
|
2023-02-07 18:16:36 +08:00
|
|
|
/// <summary>
|
2024-02-04 08:02:39 +08:00
|
|
|
/// The width of spacing in terms of accuracy between the grade circles.
|
2023-02-07 18:16:36 +08:00
|
|
|
/// </summary>
|
2024-02-04 08:02:39 +08:00
|
|
|
public const double GRADE_SPACING_PERCENTAGE = 2.0 / 360;
|
2023-02-07 18:16:36 +08:00
|
|
|
|
2020-03-17 15:37:56 +08:00
|
|
|
/// <summary>
|
|
|
|
/// The easing for the circle filling transforms.
|
|
|
|
/// </summary>
|
|
|
|
public static readonly Easing ACCURACY_TRANSFORM_EASING = Easing.OutPow10;
|
|
|
|
|
|
|
|
private readonly ScoreInfo score;
|
|
|
|
|
2022-12-03 21:39:44 +08:00
|
|
|
private CircularProgress accuracyCircle;
|
2024-01-29 10:14:24 +08:00
|
|
|
private GradedCircles gradedCircles;
|
2020-03-17 15:37:56 +08:00
|
|
|
private Container<RankBadge> badges;
|
|
|
|
private RankText rankText;
|
|
|
|
|
2021-06-09 17:15:45 +08:00
|
|
|
private PoolableSkinnableSample scoreTickSound;
|
|
|
|
private PoolableSkinnableSample badgeTickSound;
|
|
|
|
private PoolableSkinnableSample badgeMaxSound;
|
|
|
|
private PoolableSkinnableSample swooshUpSound;
|
|
|
|
private PoolableSkinnableSample rankImpactSound;
|
|
|
|
private PoolableSkinnableSample rankApplauseSound;
|
2021-05-27 14:04:22 +08:00
|
|
|
|
2021-06-09 18:24:30 +08:00
|
|
|
private readonly Bindable<double> tickPlaybackRate = new Bindable<double>();
|
2021-06-09 18:09:00 +08:00
|
|
|
|
2021-05-27 14:04:22 +08:00
|
|
|
private double lastTickPlaybackTime;
|
|
|
|
private bool isTicking;
|
|
|
|
|
2023-11-29 18:05:24 +08:00
|
|
|
private readonly double accuracyX;
|
|
|
|
private readonly double accuracyS;
|
|
|
|
private readonly double accuracyA;
|
|
|
|
private readonly double accuracyB;
|
|
|
|
private readonly double accuracyC;
|
|
|
|
private readonly double accuracyD;
|
2021-06-09 17:46:38 +08:00
|
|
|
private readonly bool withFlair;
|
2021-05-27 14:04:22 +08:00
|
|
|
|
2024-01-22 20:31:17 +08:00
|
|
|
private readonly bool isFailedSDueToMisses;
|
|
|
|
private RankText failedSRankText;
|
|
|
|
|
2021-06-09 17:46:38 +08:00
|
|
|
public AccuracyCircle(ScoreInfo score, bool withFlair = false)
|
2020-03-17 15:37:56 +08:00
|
|
|
{
|
|
|
|
this.score = score;
|
2021-06-09 17:46:38 +08:00
|
|
|
this.withFlair = withFlair;
|
2023-11-29 18:05:24 +08:00
|
|
|
|
|
|
|
ScoreProcessor scoreProcessor = score.Ruleset.CreateInstance().CreateScoreProcessor();
|
|
|
|
accuracyX = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.X);
|
|
|
|
accuracyS = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.S);
|
2024-01-22 20:31:17 +08:00
|
|
|
|
2023-11-29 18:05:24 +08:00
|
|
|
accuracyA = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.A);
|
|
|
|
accuracyB = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.B);
|
|
|
|
accuracyC = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.C);
|
|
|
|
accuracyD = scoreProcessor.AccuracyCutoffFromRank(ScoreRank.D);
|
2024-01-22 20:31:17 +08:00
|
|
|
|
|
|
|
isFailedSDueToMisses = score.Accuracy >= accuracyS && score.Rank == ScoreRank.A;
|
2021-05-27 14:04:22 +08:00
|
|
|
}
|
|
|
|
|
2020-03-17 15:37:56 +08:00
|
|
|
[BackgroundDependencyLoader]
|
2022-01-15 08:06:39 +08:00
|
|
|
private void load()
|
2020-03-17 15:37:56 +08:00
|
|
|
{
|
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
2022-12-03 21:39:44 +08:00
|
|
|
new CircularProgress
|
2020-03-17 15:37:56 +08:00
|
|
|
{
|
|
|
|
Name = "Background circle",
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = OsuColour.Gray(47),
|
|
|
|
Alpha = 0.5f,
|
|
|
|
InnerRadius = accuracy_circle_radius + 0.01f, // Extends a little bit into the circle
|
|
|
|
Current = { Value = 1 },
|
|
|
|
},
|
2022-12-03 21:39:44 +08:00
|
|
|
accuracyCircle = new CircularProgress
|
2020-03-17 15:37:56 +08:00
|
|
|
{
|
|
|
|
Name = "Accuracy circle",
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Colour = ColourInfo.GradientVertical(Color4Extensions.FromHex("#7CF6FF"), Color4Extensions.FromHex("#BAFFA9")),
|
|
|
|
InnerRadius = accuracy_circle_radius,
|
|
|
|
},
|
2024-02-04 07:58:15 +08:00
|
|
|
new Container
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Size = new Vector2(0.8f),
|
|
|
|
Padding = new MarginPadding(2.5f),
|
|
|
|
Child = gradedCircles = new GradedCircles(accuracyC, accuracyB, accuracyA, accuracyS, accuracyX)
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both
|
|
|
|
}
|
|
|
|
},
|
2020-03-17 15:37:56 +08:00
|
|
|
badges = new Container<RankBadge>
|
|
|
|
{
|
|
|
|
Name = "Rank badges",
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
Padding = new MarginPadding { Vertical = -15, Horizontal = -20 },
|
|
|
|
Children = new[]
|
|
|
|
{
|
2023-11-29 19:29:50 +08:00
|
|
|
new RankBadge(accuracyD, Interpolation.Lerp(accuracyD, accuracyC, 0.5), getRank(ScoreRank.D)),
|
|
|
|
new RankBadge(accuracyC, Interpolation.Lerp(accuracyC, accuracyB, 0.5), getRank(ScoreRank.C)),
|
|
|
|
new RankBadge(accuracyB, Interpolation.Lerp(accuracyB, accuracyA, 0.5), getRank(ScoreRank.B)),
|
2023-02-09 07:34:28 +08:00
|
|
|
// The S and A badges are moved down slightly to prevent collision with the SS badge.
|
2023-11-29 18:05:24 +08:00
|
|
|
new RankBadge(accuracyA, Interpolation.Lerp(accuracyA, accuracyS, 0.25), getRank(ScoreRank.A)),
|
2024-01-29 10:14:24 +08:00
|
|
|
new RankBadge(accuracyS, Interpolation.Lerp(accuracyS, (accuracyX - VIRTUAL_SS_PERCENTAGE), 0.25), getRank(ScoreRank.S)),
|
2023-11-29 19:29:50 +08:00
|
|
|
new RankBadge(accuracyX, accuracyX, getRank(ScoreRank.X)),
|
2020-03-17 15:37:56 +08:00
|
|
|
}
|
|
|
|
},
|
|
|
|
rankText = new RankText(score.Rank)
|
|
|
|
};
|
2021-05-27 14:04:22 +08:00
|
|
|
|
2021-06-09 17:46:38 +08:00
|
|
|
if (withFlair)
|
2021-05-27 14:04:22 +08:00
|
|
|
{
|
2024-01-22 20:31:17 +08:00
|
|
|
if (isFailedSDueToMisses)
|
|
|
|
AddInternal(failedSRankText = new RankText(ScoreRank.S));
|
|
|
|
|
2021-06-09 18:06:37 +08:00
|
|
|
AddRangeInternal(new Drawable[]
|
|
|
|
{
|
|
|
|
rankImpactSound = new PoolableSkinnableSample(new SampleInfo(impactSampleName)),
|
|
|
|
rankApplauseSound = new PoolableSkinnableSample(new SampleInfo(@"applause", applauseSampleName)),
|
|
|
|
scoreTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/score-tick")),
|
|
|
|
badgeTickSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink")),
|
|
|
|
badgeMaxSound = new PoolableSkinnableSample(new SampleInfo(@"Results/badge-dink-max")),
|
|
|
|
swooshUpSound = new PoolableSkinnableSample(new SampleInfo(@"Results/swoosh-up")),
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-17 15:37:56 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
|
|
|
base.LoadComplete();
|
|
|
|
|
|
|
|
this.ScaleTo(0).Then().ScaleTo(1, APPEAR_DURATION, Easing.OutQuint);
|
|
|
|
|
2021-06-09 17:46:38 +08:00
|
|
|
if (withFlair)
|
2021-05-28 18:27:55 +08:00
|
|
|
{
|
2021-06-09 18:24:30 +08:00
|
|
|
const double swoosh_pre_delay = 443f;
|
|
|
|
const double swoosh_volume = 0.4f;
|
|
|
|
|
|
|
|
this.Delay(swoosh_pre_delay).Schedule(() =>
|
2021-05-28 18:27:55 +08:00
|
|
|
{
|
2021-06-09 18:24:30 +08:00
|
|
|
swooshUpSound.VolumeTo(swoosh_volume);
|
2021-05-28 18:27:55 +08:00
|
|
|
swooshUpSound.Play();
|
|
|
|
});
|
|
|
|
}
|
2021-05-27 14:04:22 +08:00
|
|
|
|
2024-01-29 11:13:52 +08:00
|
|
|
using (BeginDelayedSequence(RANK_CIRCLE_TRANSFORM_DELAY))
|
|
|
|
gradedCircles.TransformTo(nameof(GradedCircles.Progress), 1.0, RANK_CIRCLE_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING);
|
2020-03-17 15:37:56 +08:00
|
|
|
|
2021-05-28 18:27:55 +08:00
|
|
|
using (BeginDelayedSequence(ACCURACY_TRANSFORM_DELAY))
|
2020-03-17 15:37:56 +08:00
|
|
|
{
|
2023-02-07 18:16:36 +08:00
|
|
|
double targetAccuracy = score.Accuracy;
|
2023-02-09 07:34:28 +08:00
|
|
|
double[] notchPercentages =
|
|
|
|
{
|
2023-11-29 18:05:24 +08:00
|
|
|
accuracyS,
|
|
|
|
accuracyA,
|
|
|
|
accuracyB,
|
|
|
|
accuracyC,
|
2023-02-09 07:34:28 +08:00
|
|
|
};
|
2023-02-07 18:16:36 +08:00
|
|
|
|
|
|
|
// Ensure the gauge overshoots or undershoots a bit so it doesn't land in the gaps of the inner graded circle (caused by `RankNotch`es),
|
|
|
|
// to prevent ambiguity on what grade it's pointing at.
|
|
|
|
foreach (double p in notchPercentages)
|
|
|
|
{
|
2024-02-04 08:02:39 +08:00
|
|
|
if (Precision.AlmostEquals(p, targetAccuracy, GRADE_SPACING_PERCENTAGE / 2))
|
2023-02-07 18:16:36 +08:00
|
|
|
{
|
|
|
|
int tippingDirection = targetAccuracy - p >= 0 ? 1 : -1; // We "round up" here to match rank criteria
|
2024-02-04 08:02:39 +08:00
|
|
|
targetAccuracy = p + tippingDirection * (GRADE_SPACING_PERCENTAGE / 2);
|
2023-02-07 18:16:36 +08:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// The final gap between 99.999...% (S) and 100% (SS) is exaggerated by `virtual_ss_percentage`. We don't want to land there either.
|
|
|
|
if (score.Rank == ScoreRank.X || score.Rank == ScoreRank.XH)
|
|
|
|
targetAccuracy = 1;
|
|
|
|
else
|
2024-02-04 08:02:39 +08:00
|
|
|
targetAccuracy = Math.Min(accuracyX - VIRTUAL_SS_PERCENTAGE - GRADE_SPACING_PERCENTAGE / 2, targetAccuracy);
|
2023-02-07 18:16:36 +08:00
|
|
|
|
|
|
|
// The accuracy circle gauge visually fills up a bit too much.
|
|
|
|
// This wouldn't normally matter but we want it to align properly with the inner graded circle in the above cases.
|
|
|
|
const double visual_alignment_offset = 0.001;
|
|
|
|
|
|
|
|
if (targetAccuracy < 1 && targetAccuracy >= visual_alignment_offset)
|
|
|
|
targetAccuracy -= visual_alignment_offset;
|
2020-03-17 15:37:56 +08:00
|
|
|
|
|
|
|
accuracyCircle.FillTo(targetAccuracy, ACCURACY_TRANSFORM_DURATION, ACCURACY_TRANSFORM_EASING);
|
|
|
|
|
2021-06-09 17:46:38 +08:00
|
|
|
if (withFlair)
|
2021-05-27 14:04:22 +08:00
|
|
|
{
|
2021-06-02 15:57:09 +08:00
|
|
|
Schedule(() =>
|
2021-05-28 18:27:55 +08:00
|
|
|
{
|
2021-06-09 18:24:30 +08:00
|
|
|
const double score_tick_debounce_rate_start = 18f;
|
|
|
|
const double score_tick_debounce_rate_end = 300f;
|
|
|
|
const double score_tick_volume_start = 0.6f;
|
|
|
|
const double score_tick_volume_end = 1.0f;
|
|
|
|
|
|
|
|
this.TransformBindableTo(tickPlaybackRate, score_tick_debounce_rate_start);
|
|
|
|
this.TransformBindableTo(tickPlaybackRate, score_tick_debounce_rate_end, ACCURACY_TRANSFORM_DURATION, Easing.OutSine);
|
|
|
|
|
|
|
|
scoreTickSound.FrequencyTo(1 + targetAccuracy, ACCURACY_TRANSFORM_DURATION, Easing.OutSine);
|
|
|
|
scoreTickSound.VolumeTo(score_tick_volume_start).Then().VolumeTo(score_tick_volume_end, ACCURACY_TRANSFORM_DURATION, Easing.OutSine);
|
2021-05-27 14:04:22 +08:00
|
|
|
|
2021-06-02 15:57:09 +08:00
|
|
|
isTicking = true;
|
|
|
|
});
|
|
|
|
}
|
2021-05-27 14:04:22 +08:00
|
|
|
|
|
|
|
int badgeNum = 0;
|
|
|
|
|
2020-03-17 15:37:56 +08:00
|
|
|
foreach (var badge in badges)
|
|
|
|
{
|
|
|
|
if (badge.Accuracy > score.Accuracy)
|
|
|
|
continue;
|
|
|
|
|
2024-01-29 10:14:24 +08:00
|
|
|
using (BeginDelayedSequence(inverseEasing(ACCURACY_TRANSFORM_EASING, Math.Min(accuracyX - VIRTUAL_SS_PERCENTAGE, badge.Accuracy) / targetAccuracy) * ACCURACY_TRANSFORM_DURATION))
|
2020-10-29 15:11:37 +08:00
|
|
|
{
|
2020-03-17 15:37:56 +08:00
|
|
|
badge.Appear();
|
2021-05-28 18:27:55 +08:00
|
|
|
|
2021-06-09 17:46:38 +08:00
|
|
|
if (withFlair)
|
2021-05-27 14:04:22 +08:00
|
|
|
{
|
2021-06-02 15:57:09 +08:00
|
|
|
Schedule(() =>
|
|
|
|
{
|
2021-06-09 17:15:45 +08:00
|
|
|
var dink = badgeNum < badges.Count - 1 ? badgeTickSound : badgeMaxSound;
|
|
|
|
|
2021-06-02 15:57:09 +08:00
|
|
|
dink.FrequencyTo(1 + badgeNum++ * 0.05);
|
|
|
|
dink.Play();
|
|
|
|
});
|
|
|
|
}
|
2020-10-29 15:11:37 +08:00
|
|
|
}
|
2020-03-17 15:37:56 +08:00
|
|
|
}
|
|
|
|
|
2021-05-28 18:27:55 +08:00
|
|
|
using (BeginDelayedSequence(TEXT_APPEAR_DELAY))
|
2020-10-29 15:11:37 +08:00
|
|
|
{
|
2020-03-17 15:37:56 +08:00
|
|
|
rankText.Appear();
|
2021-05-28 18:27:55 +08:00
|
|
|
|
2021-06-09 17:46:38 +08:00
|
|
|
if (!withFlair) return;
|
2021-06-02 15:57:09 +08:00
|
|
|
|
2021-05-27 14:04:22 +08:00
|
|
|
Schedule(() =>
|
|
|
|
{
|
|
|
|
isTicking = false;
|
2021-06-02 15:57:09 +08:00
|
|
|
rankImpactSound.Play();
|
2021-05-27 14:04:22 +08:00
|
|
|
});
|
|
|
|
|
2021-06-09 18:24:30 +08:00
|
|
|
const double applause_pre_delay = 545f;
|
|
|
|
const double applause_volume = 0.8f;
|
|
|
|
|
|
|
|
using (BeginDelayedSequence(applause_pre_delay))
|
2021-05-27 14:04:22 +08:00
|
|
|
{
|
|
|
|
Schedule(() =>
|
|
|
|
{
|
2021-06-09 18:24:30 +08:00
|
|
|
rankApplauseSound.VolumeTo(applause_volume);
|
2021-06-02 15:57:09 +08:00
|
|
|
rankApplauseSound.Play();
|
2021-05-27 14:04:22 +08:00
|
|
|
});
|
|
|
|
}
|
2020-10-29 15:11:37 +08:00
|
|
|
}
|
2024-01-22 20:31:17 +08:00
|
|
|
|
|
|
|
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
|
2024-02-04 08:02:39 +08:00
|
|
|
.FillTo(accuracyS - GRADE_SPACING_PERCENTAGE / 2 - visual_alignment_offset, 70, Easing.OutQuint);
|
2024-01-22 20:31:17 +08:00
|
|
|
|
2024-01-25 13:57:42 +08:00
|
|
|
badges.Single(b => b.Rank == getRank(ScoreRank.S))
|
2024-01-22 20:31:17 +08:00
|
|
|
.FadeOut(70, Easing.OutQuint);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-03-17 15:37:56 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-09 18:31:53 +08:00
|
|
|
protected override void Update()
|
|
|
|
{
|
|
|
|
base.Update();
|
|
|
|
|
|
|
|
if (isTicking && Clock.CurrentTime - lastTickPlaybackTime >= tickPlaybackRate.Value)
|
|
|
|
{
|
|
|
|
scoreTickSound?.Play();
|
|
|
|
lastTickPlaybackTime = Clock.CurrentTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-09 18:15:55 +08:00
|
|
|
private string applauseSampleName
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
switch (score.Rank)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case ScoreRank.D:
|
2021-06-09 18:35:05 +08:00
|
|
|
return @"Results/applause-d";
|
2021-06-09 18:15:55 +08:00
|
|
|
|
|
|
|
case ScoreRank.C:
|
2021-06-09 18:35:05 +08:00
|
|
|
return @"Results/applause-c";
|
2021-06-09 18:15:55 +08:00
|
|
|
|
|
|
|
case ScoreRank.B:
|
2021-06-09 18:35:05 +08:00
|
|
|
return @"Results/applause-b";
|
2021-06-09 18:15:55 +08:00
|
|
|
|
|
|
|
case ScoreRank.A:
|
2021-06-09 18:35:05 +08:00
|
|
|
return @"Results/applause-a";
|
2021-06-09 18:15:55 +08:00
|
|
|
|
|
|
|
case ScoreRank.S:
|
|
|
|
case ScoreRank.SH:
|
|
|
|
case ScoreRank.X:
|
|
|
|
case ScoreRank.XH:
|
2021-06-09 18:35:05 +08:00
|
|
|
return @"Results/applause-s";
|
2021-06-09 18:15:55 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-09 18:06:37 +08:00
|
|
|
private string impactSampleName
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
switch (score.Rank)
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case ScoreRank.D:
|
|
|
|
return @"Results/rank-impact-fail-d";
|
|
|
|
|
|
|
|
case ScoreRank.C:
|
|
|
|
case ScoreRank.B:
|
|
|
|
return @"Results/rank-impact-fail";
|
|
|
|
|
|
|
|
case ScoreRank.A:
|
|
|
|
case ScoreRank.S:
|
|
|
|
case ScoreRank.SH:
|
|
|
|
return @"Results/rank-impact-pass";
|
|
|
|
|
|
|
|
case ScoreRank.X:
|
|
|
|
case ScoreRank.XH:
|
|
|
|
return @"Results/rank-impact-pass-ss";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private ScoreRank getRank(ScoreRank rank)
|
|
|
|
{
|
|
|
|
foreach (var mod in score.Mods.OfType<IApplicableToScoreProcessor>())
|
|
|
|
rank = mod.AdjustRank(rank, score.Accuracy);
|
|
|
|
|
|
|
|
return rank;
|
|
|
|
}
|
|
|
|
|
2020-03-17 15:37:56 +08:00
|
|
|
private double inverseEasing(Easing easing, double targetValue)
|
|
|
|
{
|
|
|
|
double test = 0;
|
|
|
|
double result = 0;
|
|
|
|
int count = 2;
|
|
|
|
|
|
|
|
while (Math.Abs(result - targetValue) > 0.005)
|
|
|
|
{
|
|
|
|
int dir = Math.Sign(targetValue - result);
|
|
|
|
|
|
|
|
test += dir * 1.0 / count;
|
|
|
|
result = Interpolation.ApplyEasing(easing, test);
|
|
|
|
|
|
|
|
count++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return test;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|