diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs index 08a9714fd8..d37f6c5e5f 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/CounterStatistic.cs @@ -6,7 +6,6 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; -using osu.Game.Screens.Ranking.Expanded.Accuracy; using osuTK; namespace osu.Game.Screens.Ranking.Expanded.Statistics @@ -19,7 +18,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics private readonly int count; private readonly int? maxCount; - protected RollingCounter Counter { get; private set; } + private RollingCounter counter; /// /// Creates a new . @@ -37,7 +36,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics public override void Appear() { base.Appear(); - Counter.Current.Value = count; + counter.Current.Value = count; } protected override Drawable CreateContent() @@ -46,7 +45,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics { AutoSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, - Child = Counter = new StatisticCounter + Child = counter = new StatisticCounter { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre @@ -67,18 +66,5 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics return container; } - - private class StatisticCounter : RollingCounter - { - protected override double RollingDuration => AccuracyCircle.ACCURACY_TRANSFORM_DURATION; - - protected override Easing RollingEasing => AccuracyCircle.ACCURACY_TRANSFORM_EASING; - - protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s => - { - s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true); - s.Spacing = new Vector2(-2, 0); - }); - } } } diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs index 1b4edb99d7..cd9d8005c6 100644 --- a/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/PerformanceStatistic.cs @@ -5,11 +5,13 @@ using System; using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Game.Graphics.UserInterface; using osu.Game.Scoring; namespace osu.Game.Screens.Ranking.Expanded.Statistics { - public class PerformanceStatistic : CounterStatistic + public class PerformanceStatistic : StatisticDisplay { private readonly ScoreInfo score; @@ -17,8 +19,10 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource(); + private RollingCounter counter; + public PerformanceStatistic(ScoreInfo score) - : base("PP", 0) + : base("PP") { this.score = score; } @@ -46,7 +50,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics public override void Appear() { base.Appear(); - Counter.Current.BindTo(performance); + counter.Current.BindTo(performance); } protected override void Dispose(bool isDisposing) @@ -54,5 +58,11 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics cancellationTokenSource?.Cancel(); base.Dispose(isDisposing); } + + protected override Drawable CreateContent() => counter = new StatisticCounter + { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre + }; } } diff --git a/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticCounter.cs b/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticCounter.cs new file mode 100644 index 0000000000..bbcfc43dc8 --- /dev/null +++ b/osu.Game/Screens/Ranking/Expanded/Statistics/StatisticCounter.cs @@ -0,0 +1,25 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; +using osu.Game.Screens.Ranking.Expanded.Accuracy; +using osuTK; + +namespace osu.Game.Screens.Ranking.Expanded.Statistics +{ + public class StatisticCounter : RollingCounter + { + protected override double RollingDuration => AccuracyCircle.ACCURACY_TRANSFORM_DURATION; + + protected override Easing RollingEasing => AccuracyCircle.ACCURACY_TRANSFORM_EASING; + + protected override OsuSpriteText CreateSpriteText() => base.CreateSpriteText().With(s => + { + s.Font = OsuFont.Torus.With(size: 20, fixedWidth: true); + s.Spacing = new Vector2(-2, 0); + }); + } +}