mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 06:52:55 +08:00
Use TransformTo in rolling counters
This commit is contained in:
parent
a5d0bfb02f
commit
c73a1ae058
@ -15,6 +15,7 @@ using OpenTK.Graphics;
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
public abstract class RollingCounter<T> : Container, IHasAccentColour
|
||||
where T : struct, IEquatable<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// The current value.
|
||||
@ -193,27 +194,12 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
protected void TransformCount(Transform<T, Drawable> transform, T currentValue, T newValue)
|
||||
{
|
||||
Type type = transform.GetType();
|
||||
|
||||
Flush(false, type);
|
||||
|
||||
if (RollingDuration < 1)
|
||||
{
|
||||
DisplayedCount = Current;
|
||||
return;
|
||||
}
|
||||
|
||||
double rollingTotalDuration =
|
||||
IsRollingProportional
|
||||
? GetProportionalDuration(currentValue, newValue)
|
||||
: RollingDuration;
|
||||
|
||||
transform.StartTime = TransformStartTime;
|
||||
transform.EndTime = TransformStartTime + rollingTotalDuration;
|
||||
transform.EndValue = newValue;
|
||||
transform.Easing = RollingEasing;
|
||||
|
||||
Transforms.Add(transform);
|
||||
TransformTo(newValue, rollingTotalDuration, RollingEasing, transform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,20 +188,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
private void transformRoll(TransformComboRoll transform, int currentValue, int newValue)
|
||||
{
|
||||
Flush(false, typeof(TransformComboRoll));
|
||||
|
||||
if (RollingDuration < 1)
|
||||
{
|
||||
DisplayedCount = Current;
|
||||
return;
|
||||
}
|
||||
|
||||
transform.StartTime = Time.Current;
|
||||
transform.EndTime = Time.Current + getProportionalDuration(currentValue, newValue);
|
||||
transform.EndValue = newValue;
|
||||
transform.Easing = RollingEasing;
|
||||
|
||||
Transforms.Add(transform);
|
||||
TransformTo(newValue, getProportionalDuration(currentValue, newValue), RollingEasing, new TransformComboRoll());
|
||||
}
|
||||
|
||||
protected class TransformComboRoll : Transform<int, Drawable>
|
||||
|
Loading…
Reference in New Issue
Block a user