1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-27 15:53:19 +08:00

Children creation off-load to ctors

This commit is contained in:
Adonais Romero González 2016-10-12 14:38:48 -05:00
parent 798e7241d8
commit 11e0429fd3
2 changed files with 27 additions and 29 deletions

View File

@ -54,16 +54,12 @@ namespace osu.Game.Graphics.UserInterface
}
protected override void transformVisibleCount(T currentValue, T newValue)
{
if (countSpriteText != null)
{
countSpriteText.Text = formatCount(newValue);
}
}
protected virtual void updateTextSize()
{
if (countSpriteText != null)
countSpriteText.TextSize = TextSize;
}
}

View File

@ -29,27 +29,32 @@ namespace osu.Game.Graphics.UserInterface
public StandardComboCounter() : base()
{
IsRollingContinuous = false;
countSpriteText.Alpha = 0;
popOutSpriteText = new SpriteText
{
Origin = this.Origin,
Anchor = this.Anchor,
TextSize = this.TextSize,
Alpha = 0,
};
}
public override void Load(BaseGame game)
{
base.Load(game);
countSpriteText.Alpha = 0;
Add(popOutSpriteText = new SpriteText
{
Text = formatCount(Count),
Origin = this.Origin,
Anchor = this.Anchor,
TextSize = this.TextSize,
Alpha = 0,
});
popOutSpriteText.Origin = this.Origin;
popOutSpriteText.Anchor = this.Anchor;
Add(popOutSpriteText);
}
protected override void updateTextSize()
{
base.updateTextSize();
if (popOutSpriteText != null)
popOutSpriteText.TextSize = this.TextSize;
}
@ -90,8 +95,6 @@ namespace osu.Game.Graphics.UserInterface
}
protected override void transformVisibleCount(ulong currentValue, ulong newValue)
{
if (countSpriteText != null && popOutSpriteText != null)
{
countSpriteText.Text = popOutSpriteText.Text = formatCount(newValue);
if (newValue == 0)
@ -106,5 +109,4 @@ namespace osu.Game.Graphics.UserInterface
}
}
}
}
}