diff --git a/osu.Game/Graphics/UserInterface/NumericRollingCounter.cs b/osu.Game/Graphics/UserInterface/NumericRollingCounter.cs index e1cb9ddbb4..1710ce9515 100644 --- a/osu.Game/Graphics/UserInterface/NumericRollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/NumericRollingCounter.cs @@ -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) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index b0686ca0cb..b26c810497 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -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. /// /// Type of the actual counter. - public abstract class RollingCounter : Container + public abstract class RollingCounter : AutoSizeContainer { /// /// 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)) || transformType == typeof(Transform), @@ -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; diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index d5b9edf73d..802d2b9883 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -17,11 +17,14 @@ namespace osu.Game.Graphics.UserInterface /// 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) diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index 790e0ddcc8..a8eb18b565 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -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;