diff --git a/osu.Game/Graphics/UserInterface/AlternativeComboCounter.cs b/osu.Game/Graphics/UserInterface/AlternativeComboCounter.cs
index 6e292cdd9d..114092384b 100644
--- a/osu.Game/Graphics/UserInterface/AlternativeComboCounter.cs
+++ b/osu.Game/Graphics/UserInterface/AlternativeComboCounter.cs
@@ -32,9 +32,9 @@ namespace osu.Game.Graphics.UserInterface
OriginalColour = Colour;
}
- protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
+ protected override double getProportionalDuration(ulong currentValue, ulong newValue)
{
- ulong difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
+ double difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
return difference * RollingDuration;
}
diff --git a/osu.Game/Graphics/UserInterface/ComboCounter.cs b/osu.Game/Graphics/UserInterface/ComboCounter.cs
index c510f02808..d5c019e644 100644
--- a/osu.Game/Graphics/UserInterface/ComboCounter.cs
+++ b/osu.Game/Graphics/UserInterface/ComboCounter.cs
@@ -21,10 +21,6 @@ namespace osu.Game.Graphics.UserInterface
{
protected Type transformType => typeof(TransformCombo);
- private bool rolling = false;
-
- protected ulong rollingTotalDuration;
-
///
/// If true, the roll-down duration will be proportional to the counter.
///
@@ -34,7 +30,7 @@ namespace osu.Game.Graphics.UserInterface
/// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each
/// element; else duration in milliseconds for the counter roll-up animation in total.
///
- public ulong RollingDuration = 20;
+ public double RollingDuration = 20;
///
/// Easing for the counter rollover animation.
@@ -78,17 +74,18 @@ namespace osu.Game.Graphics.UserInterface
}
set
{
- prevPrevCount = prevCount;
- prevCount = count;
- count = value;
- if (IsLoaded)
- {
- rollingTotalDuration =
- IsRollingProportional
- ? getProportionalDuration(VisibleCount, value)
- : RollingDuration;
- transformCount(VisibleCount, prevPrevCount, prevCount, value);
- }
+ setCount(value);
+ }
+ }
+
+ private void setCount(ulong value, bool rolling = false)
+ {
+ prevPrevCount = prevCount;
+ prevCount = count;
+ count = value;
+ if (IsLoaded)
+ {
+ transformCount(VisibleCount, prevPrevCount, prevCount, value, rolling);
}
}
@@ -146,9 +143,7 @@ namespace osu.Game.Graphics.UserInterface
/// Target value.
public virtual void Roll(ulong newValue = 0)
{
- rolling = true;
- Count = newValue;
- rolling = false;
+ setCount(newValue, true);
}
///
@@ -159,7 +154,7 @@ namespace osu.Game.Graphics.UserInterface
Count = default(ulong);
}
- protected virtual ulong getProportionalDuration(ulong currentValue, ulong newValue)
+ protected virtual double getProportionalDuration(ulong currentValue, ulong newValue)
{
return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
}
@@ -183,7 +178,12 @@ namespace osu.Game.Graphics.UserInterface
Transforms.RemoveAll(t => t.GetType() == typeof(TransformCombo));
}
- protected virtual void transformCount(ulong visibleValue, ulong prevValue, ulong currentValue, ulong newValue)
+ protected virtual void transformCount(
+ ulong visibleValue,
+ ulong prevValue,
+ ulong currentValue,
+ ulong newValue,
+ bool rolling)
{
if (!rolling)
{
@@ -220,6 +220,11 @@ namespace osu.Game.Graphics.UserInterface
return;
}
+ double rollingTotalDuration =
+ IsRollingProportional
+ ? getProportionalDuration(currentValue, newValue)
+ : RollingDuration;
+
transform.StartTime = Time;
transform.EndTime = Time + rollingTotalDuration;
transform.StartValue = currentValue;
diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs
index d5054c4d3d..10a8085726 100644
--- a/osu.Game/Graphics/UserInterface/RollingCounter.cs
+++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs
@@ -25,8 +25,6 @@ namespace osu.Game.Graphics.UserInterface
///
protected virtual Type transformType => typeof(Transform);
- protected double rollingTotalDuration = 0;
-
protected SpriteText countSpriteText;
///
@@ -84,10 +82,6 @@ namespace osu.Game.Graphics.UserInterface
count = value;
if (IsLoaded)
{
- rollingTotalDuration =
- IsRollingProportional
- ? getProportionalDuration(visibleCount, value)
- : RollingDuration;
transformCount(visibleCount, count);
}
}
@@ -236,6 +230,11 @@ namespace osu.Game.Graphics.UserInterface
return;
}
+ double rollingTotalDuration =
+ IsRollingProportional
+ ? getProportionalDuration(currentValue, newValue)
+ : RollingDuration;
+
transform.StartTime = Time;
transform.EndTime = Time + rollingTotalDuration;
transform.StartValue = currentValue;
diff --git a/osu.Game/Graphics/UserInterface/StandardComboCounter.cs b/osu.Game/Graphics/UserInterface/StandardComboCounter.cs
index 30f6bd4b3b..8d8fb4acab 100644
--- a/osu.Game/Graphics/UserInterface/StandardComboCounter.cs
+++ b/osu.Game/Graphics/UserInterface/StandardComboCounter.cs
@@ -64,9 +64,9 @@ namespace osu.Game.Graphics.UserInterface
Add(popOutSpriteText);
}
- protected override ulong getProportionalDuration(ulong currentValue, ulong newValue)
+ protected override double getProportionalDuration(ulong currentValue, ulong newValue)
{
- ulong difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
+ double difference = currentValue > newValue ? currentValue - newValue : currentValue - newValue;
return difference * RollingDuration;
}