Delete unnecessary class attributes

This commit is contained in:
Adonais Romero González 2016-10-13 22:54:02 -05:00
parent 9ccff6ec48
commit edbbe8daef
4 changed files with 35 additions and 31 deletions

View File

@ -32,9 +32,9 @@ namespace osu.Game.Graphics.UserInterface
OriginalColour = Colour; 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; return difference * RollingDuration;
} }

View File

@ -21,10 +21,6 @@ namespace osu.Game.Graphics.UserInterface
{ {
protected Type transformType => typeof(TransformCombo); protected Type transformType => typeof(TransformCombo);
private bool rolling = false;
protected ulong rollingTotalDuration;
/// <summary> /// <summary>
/// If true, the roll-down duration will be proportional to the counter. /// If true, the roll-down duration will be proportional to the counter.
/// </summary> /// </summary>
@ -34,7 +30,7 @@ namespace osu.Game.Graphics.UserInterface
/// If IsRollingProportional = false, duration in milliseconds for the counter roll-up animation for each /// 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. /// element; else duration in milliseconds for the counter roll-up animation in total.
/// </summary> /// </summary>
public ulong RollingDuration = 20; public double RollingDuration = 20;
/// <summary> /// <summary>
/// Easing for the counter rollover animation. /// Easing for the counter rollover animation.
@ -78,17 +74,18 @@ namespace osu.Game.Graphics.UserInterface
} }
set set
{ {
prevPrevCount = prevCount; setCount(value);
prevCount = count; }
count = value; }
if (IsLoaded)
{ private void setCount(ulong value, bool rolling = false)
rollingTotalDuration = {
IsRollingProportional prevPrevCount = prevCount;
? getProportionalDuration(VisibleCount, value) prevCount = count;
: RollingDuration; count = value;
transformCount(VisibleCount, prevPrevCount, prevCount, value); if (IsLoaded)
} {
transformCount(VisibleCount, prevPrevCount, prevCount, value, rolling);
} }
} }
@ -146,9 +143,7 @@ namespace osu.Game.Graphics.UserInterface
/// <param name="newValue">Target value.</param> /// <param name="newValue">Target value.</param>
public virtual void Roll(ulong newValue = 0) public virtual void Roll(ulong newValue = 0)
{ {
rolling = true; setCount(newValue, true);
Count = newValue;
rolling = false;
} }
/// <summary> /// <summary>
@ -159,7 +154,7 @@ namespace osu.Game.Graphics.UserInterface
Count = default(ulong); 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; return currentValue > newValue ? currentValue - newValue : newValue - currentValue;
} }
@ -183,7 +178,12 @@ namespace osu.Game.Graphics.UserInterface
Transforms.RemoveAll(t => t.GetType() == typeof(TransformCombo)); 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) if (!rolling)
{ {
@ -220,6 +220,11 @@ namespace osu.Game.Graphics.UserInterface
return; return;
} }
double rollingTotalDuration =
IsRollingProportional
? getProportionalDuration(currentValue, newValue)
: RollingDuration;
transform.StartTime = Time; transform.StartTime = Time;
transform.EndTime = Time + rollingTotalDuration; transform.EndTime = Time + rollingTotalDuration;
transform.StartValue = currentValue; transform.StartValue = currentValue;

View File

@ -25,8 +25,6 @@ namespace osu.Game.Graphics.UserInterface
/// </remarks> /// </remarks>
protected virtual Type transformType => typeof(Transform<T>); protected virtual Type transformType => typeof(Transform<T>);
protected double rollingTotalDuration = 0;
protected SpriteText countSpriteText; protected SpriteText countSpriteText;
/// <summary> /// <summary>
@ -84,10 +82,6 @@ namespace osu.Game.Graphics.UserInterface
count = value; count = value;
if (IsLoaded) if (IsLoaded)
{ {
rollingTotalDuration =
IsRollingProportional
? getProportionalDuration(visibleCount, value)
: RollingDuration;
transformCount(visibleCount, count); transformCount(visibleCount, count);
} }
} }
@ -236,6 +230,11 @@ namespace osu.Game.Graphics.UserInterface
return; return;
} }
double rollingTotalDuration =
IsRollingProportional
? getProportionalDuration(currentValue, newValue)
: RollingDuration;
transform.StartTime = Time; transform.StartTime = Time;
transform.EndTime = Time + rollingTotalDuration; transform.EndTime = Time + rollingTotalDuration;
transform.StartValue = currentValue; transform.StartValue = currentValue;

View File

@ -64,9 +64,9 @@ namespace osu.Game.Graphics.UserInterface
Add(popOutSpriteText); 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; return difference * RollingDuration;
} }