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

Make counters work again

This commit is contained in:
Adonais Romero González 2016-10-12 14:33:04 -05:00
parent 8dadc2b215
commit 798e7241d8
4 changed files with 19 additions and 11 deletions

View File

@ -32,15 +32,12 @@ namespace osu.Game.Graphics.UserInterface
}
}
public override void Load(BaseGame game)
protected NumericRollingCounter() : base()
{
base.Load(game);
Children = new Drawable[]
{
countSpriteText = new SpriteText
{
Text = formatCount(Count),
TextSize = this.TextSize,
Anchor = this.Anchor,
Origin = this.Origin,
@ -48,6 +45,14 @@ namespace osu.Game.Graphics.UserInterface
};
}
public override void Load(BaseGame game)
{
base.Load(game);
countSpriteText.Text = formatCount(count);
countSpriteText.Anchor = this.Anchor;
countSpriteText.Origin = this.Origin;
}
protected override void transformVisibleCount(T currentValue, T newValue)
{
if (countSpriteText != null)

View File

@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface
/// In order to show a value, you must implement a way to display it, i.e., as a numeric counter or a bar.
/// </remarks>
/// <typeparam name="T">Type of the actual counter.</typeparam>
public abstract class RollingCounter<T> : Container
public abstract class RollingCounter<T> : AutoSizeContainer
{
/// <summary>
/// Type of the Transform to use.
@ -91,7 +91,7 @@ namespace osu.Game.Graphics.UserInterface
{
prevCount = count;
count = value;
if (Clock != null)
if (IsLoaded)
{
RollingTotalDuration =
IsRollingProportional
@ -102,7 +102,7 @@ namespace osu.Game.Graphics.UserInterface
}
}
protected RollingCounter()
protected RollingCounter() : base()
{
Debug.Assert(
transformType.IsSubclassOf(typeof(Transform<T>)) || transformType == typeof(Transform<T>),
@ -113,7 +113,9 @@ namespace osu.Game.Graphics.UserInterface
public override void Load(BaseGame game)
{
base.Load(game);
removeTransforms(transformType);
if (Count == null)
ResetCount();
VisibleCount = Count;

View File

@ -17,11 +17,14 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public uint LeadingZeroes = 0;
public ScoreCounter() : base()
{
countSpriteText.FixedWidth = true;
}
public override void Load(BaseGame game)
{
base.Load(game);
countSpriteText.FixedWidth = true;
}
protected override string formatCount(ulong count)

View File

@ -128,8 +128,6 @@ namespace osu.Game.Graphics.UserInterface
protected void transformStarAlpha(int i, TransformAlpha transform, bool isIncrement, double startTime)
{
transform.StartTime = startTime;
//if (!isIncrement)
//transform.StartTime += StarAnimationDuration - FadeDuration;
transform.EndTime = transform.StartTime + FadeDuration;
transform.StartValue = stars[i].Alpha;
transform.EndValue = i < Count ? 1.0f : MinStarAlpha;