1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 06:52:55 +08:00

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;
}
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;
}

View File

@ -21,10 +21,6 @@ namespace osu.Game.Graphics.UserInterface
{
protected Type transformType => typeof(TransformCombo);
private bool rolling = false;
protected ulong rollingTotalDuration;
/// <summary>
/// If true, the roll-down duration will be proportional to the counter.
/// </summary>
@ -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.
/// </summary>
public ulong RollingDuration = 20;
public double RollingDuration = 20;
/// <summary>
/// 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
/// <param name="newValue">Target value.</param>
public virtual void Roll(ulong newValue = 0)
{
rolling = true;
Count = newValue;
rolling = false;
setCount(newValue, true);
}
/// <summary>
@ -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;

View File

@ -25,8 +25,6 @@ namespace osu.Game.Graphics.UserInterface
/// </remarks>
protected virtual Type transformType => typeof(Transform<T>);
protected double rollingTotalDuration = 0;
protected SpriteText countSpriteText;
/// <summary>
@ -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;

View File

@ -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;
}