mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:43:04 +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
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public abstract class RollingCounter<T> : Container, IHasAccentColour
|
public abstract class RollingCounter<T> : Container, IHasAccentColour
|
||||||
|
where T : struct, IEquatable<T>
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current value.
|
/// The current value.
|
||||||
@ -193,27 +194,12 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected void TransformCount(Transform<T, Drawable> transform, T currentValue, T newValue)
|
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 =
|
double rollingTotalDuration =
|
||||||
IsRollingProportional
|
IsRollingProportional
|
||||||
? GetProportionalDuration(currentValue, newValue)
|
? GetProportionalDuration(currentValue, newValue)
|
||||||
: RollingDuration;
|
: RollingDuration;
|
||||||
|
|
||||||
transform.StartTime = TransformStartTime;
|
TransformTo(newValue, rollingTotalDuration, RollingEasing, transform);
|
||||||
transform.EndTime = TransformStartTime + rollingTotalDuration;
|
|
||||||
transform.EndValue = newValue;
|
|
||||||
transform.Easing = RollingEasing;
|
|
||||||
|
|
||||||
Transforms.Add(transform);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -188,20 +188,7 @@ namespace osu.Game.Screens.Play.HUD
|
|||||||
|
|
||||||
private void transformRoll(TransformComboRoll transform, int currentValue, int newValue)
|
private void transformRoll(TransformComboRoll transform, int currentValue, int newValue)
|
||||||
{
|
{
|
||||||
Flush(false, typeof(TransformComboRoll));
|
TransformTo(newValue, getProportionalDuration(currentValue, newValue), RollingEasing, new 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class TransformComboRoll : Transform<int, Drawable>
|
protected class TransformComboRoll : Transform<int, Drawable>
|
||||||
|
Loading…
Reference in New Issue
Block a user