Inherit PerformanceStatistic from CounterStatistic

This commit is contained in:
Lucas A
2020-09-27 09:37:57 +02:00
parent 84cc6068f5
commit 3cb9103fe0
2 changed files with 7 additions and 30 deletions

View File

@ -4,18 +4,12 @@
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
using osu.Game.Scoring;
using osu.Game.Screens.Ranking.Expanded.Accuracy;
using osuTK;
namespace osu.Game.Screens.Ranking.Expanded.Statistics
{
public class PerformanceStatistic : StatisticDisplay
public class PerformanceStatistic : CounterStatistic
{
private readonly ScoreInfo score;
@ -23,10 +17,8 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
private readonly CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();
private RollingCounter<int> counter;
public PerformanceStatistic(ScoreInfo score)
: base("PP")
: base("PP", 0)
{
this.score = score;
}
@ -49,22 +41,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
public override void Appear()
{
base.Appear();
counter.Current.BindTo(performance);
}
protected override Drawable CreateContent() => counter = new Counter();
private class Counter : RollingCounter<int>
{
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);
});
Counter.Current.BindTo(performance);
}
protected override void Dispose(bool isDisposing)