// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. #nullable disable using osu.Framework.Graphics; using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Resources.Localisation.Web; using osu.Game.Screens.Ranking.Expanded.Accuracy; using osu.Game.Utils; using osuTK; namespace osu.Game.Screens.Ranking.Expanded.Statistics { /// /// A to display the player's accuracy. /// public partial class AccuracyStatistic : StatisticDisplay { private readonly double accuracy; private RollingCounter counter; /// /// Creates a new . /// /// The accuracy to display. public AccuracyStatistic(double accuracy) : base(BeatmapsetsStrings.ShowScoreboardHeadersAccuracy) { this.accuracy = accuracy; } public override void Appear() { base.Appear(); counter.Current.Value = accuracy; } protected override Drawable CreateContent() => counter = new Counter(); private partial class Counter : RollingCounter { protected override double RollingDuration => AccuracyCircle.ACCURACY_TRANSFORM_DURATION; protected override Easing RollingEasing => AccuracyCircle.ACCURACY_TRANSFORM_EASING; protected override LocalisableString FormatCount(double count) => count.FormatAccuracy(); protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s => { s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true); s.Spacing = new Vector2(-2, 0); }); } } }