2020-09-12 20:34:57 +00: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.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
|
|
|
|
namespace osu.Game.Skinning
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// An integer <see cref="RollingCounter{T}"/> that uses number sprites from a legacy skin.
|
|
|
|
/// </summary>
|
|
|
|
public partial class LegacyRollingCounter : RollingCounter<int>
|
|
|
|
{
|
2021-03-06 23:28:08 +00:00
|
|
|
private readonly LegacyFont font;
|
2020-09-12 20:34:57 +00:00
|
|
|
|
|
|
|
protected override bool IsRollingProportional => true;
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Creates a new <see cref="LegacyRollingCounter"/>.
|
|
|
|
/// </summary>
|
2021-03-06 23:28:08 +00:00
|
|
|
/// <param name="font">The legacy font to use for the counter.</param>
|
2021-05-10 13:36:20 +00:00
|
|
|
public LegacyRollingCounter(LegacyFont font)
|
2020-09-12 20:34:57 +00:00
|
|
|
{
|
2021-03-06 23:28:08 +00:00
|
|
|
this.font = font;
|
2020-09-12 20:34:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override double GetProportionalDuration(int currentValue, int newValue)
|
|
|
|
{
|
|
|
|
return Math.Abs(newValue - currentValue) * 75.0;
|
|
|
|
}
|
|
|
|
|
2021-05-10 13:36:20 +00:00
|
|
|
protected sealed override OsuSpriteText CreateSpriteText() => new LegacySpriteText(font);
|
2020-09-12 20:34:57 +00:00
|
|
|
}
|
|
|
|
}
|