mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Nicer generic rolling counters
This commit is contained in:
@ -10,8 +10,6 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public class ScoreCounter : RollingCounter<double>
|
||||
{
|
||||
protected override Type TransformType => typeof(TransformScore);
|
||||
|
||||
protected override double RollingDuration => 1000;
|
||||
protected override EasingTypes RollingEasing => EasingTypes.Out;
|
||||
|
||||
@ -55,23 +53,5 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
Current.Value = Current + amount;
|
||||
}
|
||||
|
||||
protected class TransformScore : Transform<double, Drawable>
|
||||
{
|
||||
public virtual double CurrentValue
|
||||
{
|
||||
get
|
||||
{
|
||||
double time = Time?.Current ?? 0;
|
||||
if (time < StartTime) return StartValue;
|
||||
if (time >= EndTime) return EndValue;
|
||||
|
||||
return Interpolation.ValueAt(time, (float)StartValue, (float)EndValue, StartTime, EndTime, Easing);
|
||||
}
|
||||
}
|
||||
|
||||
public override void Apply(Drawable d) => ((ScoreCounter)d).DisplayedCount = CurrentValue;
|
||||
public override void ReadIntoStartValue(Drawable d) => StartValue = ((ScoreCounter)d).DisplayedCount;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user