2021-10-10 16:56:32 +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
|
|
|
|
|
2021-10-10 16:56:32 +08:00
|
|
|
using osu.Framework.Extensions.LocalisationExtensions;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Localisation;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.UserInterface
|
|
|
|
{
|
|
|
|
public abstract class CommaSeparatedScoreCounter : RollingCounter<double>
|
|
|
|
{
|
|
|
|
protected override double RollingDuration => 1000;
|
|
|
|
protected override Easing RollingEasing => Easing.Out;
|
|
|
|
|
|
|
|
protected override double GetProportionalDuration(double currentValue, double newValue) =>
|
|
|
|
currentValue > newValue ? currentValue - newValue : newValue - currentValue;
|
|
|
|
|
|
|
|
protected override LocalisableString FormatCount(double count) => ((long)count).ToLocalisableString(@"N0");
|
|
|
|
|
|
|
|
protected override OsuSpriteText CreateSpriteText()
|
|
|
|
=> base.CreateSpriteText().With(s => s.Font = s.Font.With(fixedWidth: true));
|
|
|
|
}
|
|
|
|
}
|