Nicer generic rolling counters

This commit is contained in:
Thomas Müller
2017-07-14 19:14:07 +03:00
parent b5fbb26f8f
commit fd58c6e835
5 changed files with 34 additions and 102 deletions

View File

@ -13,8 +13,6 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public class SimpleComboCounter : RollingCounter<int>
{
protected override Type TransformType => typeof(TransformCounterCount);
protected override double RollingDuration => 750;
public SimpleComboCounter()
@ -36,23 +34,5 @@ namespace osu.Game.Graphics.UserInterface
{
Current.Value = Current + amount;
}
private class TransformCounterCount : Transform<int, Drawable>
{
public int CurrentValue
{
get
{
double time = Time?.Current ?? 0;
if (time < StartTime) return StartValue;
if (time >= EndTime) return EndValue;
return (int)Interpolation.ValueAt(time, StartValue, EndValue, StartTime, EndTime, Easing);
}
}
public override void Apply(Drawable d) => ((SimpleComboCounter)d).DisplayedCount = CurrentValue;
public override void ReadIntoStartValue(Drawable d) => StartValue = ((SimpleComboCounter)d).DisplayedCount;
}
}
}