1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 02:17:46 +08:00
osu-lazer/osu.Game/Skinning/LegacyRollingCounter.cs

39 lines
1.3 KiB
C#
Raw Normal View History

2020-09-13 04:34:57 +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.
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 class LegacyRollingCounter : RollingCounter<int>
{
private readonly ISkin skin;
2021-03-07 07:28:08 +08:00
private readonly LegacyFont font;
2020-09-13 04:34:57 +08:00
protected override bool IsRollingProportional => true;
/// <summary>
/// Creates a new <see cref="LegacyRollingCounter"/>.
/// </summary>
/// <param name="skin">The <see cref="ISkin"/> from which to get counter number sprites.</param>
2021-03-07 07:28:08 +08:00
/// <param name="font">The legacy font to use for the counter.</param>
public LegacyRollingCounter(ISkin skin, LegacyFont font)
2020-09-13 04:34:57 +08:00
{
this.skin = skin;
2021-03-07 07:28:08 +08:00
this.font = font;
2020-09-13 04:34:57 +08:00
}
protected override double GetProportionalDuration(int currentValue, int newValue)
{
return Math.Abs(newValue - currentValue) * 75.0;
}
2021-03-07 07:28:08 +08:00
protected sealed override OsuSpriteText CreateSpriteText() => new LegacySpriteText(skin, font);
2020-09-13 04:34:57 +08:00
}
}