From 73e4359e9d0799243e93a5b0c367d6e2995488e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adonais=20Romero=20Gonz=C3=A1lez?= Date: Wed, 12 Oct 2016 20:51:50 -0500 Subject: [PATCH] Adjusted StarCounter ctor --- .../Graphics/UserInterface/StarCounter.cs | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index a8eb18b565..4f038764e7 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -27,19 +27,35 @@ namespace osu.Game.Graphics.UserInterface protected Container starContainer; protected List stars = new List(); + public int MaxStars + { + get; + protected set; + } + public ulong StarAnimationDuration = 500; public EasingTypes StarAnimationEasing = EasingTypes.OutElasticHalf; public ulong FadeDuration = 100; public float MinStarSize = 0.3f; public float MinStarAlpha = 0.5f; - public int MaxStars = 10; public int StarSize = 20; public int StarSpacing = 4; - public StarCounter() : base() + public StarCounter(int stars = 10) : base() { IsRollingProportional = true; RollingDuration = 150; + + MaxStars = stars; + + Children = new Drawable[] + { + starContainer = new Container + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + } + }; } protected override ulong getProportionalDuration(float currentValue, float newValue) @@ -57,16 +73,8 @@ namespace osu.Game.Graphics.UserInterface { base.Load(game); - Children = new Drawable[] - { - starContainer = new Container - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing, - Height = StarSize, - } - }; + starContainer.Width = MaxStars * StarSize + Math.Max(MaxStars - 1, 0) * StarSpacing; + starContainer.Height = StarSize; for (int i = 0; i < MaxStars; i++) {