From b4bb3d6317a31d82412de0a1c64a3947dd92670b Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Mon, 26 Sep 2016 14:07:43 +0800 Subject: [PATCH] Update private methods implementation. --- osu.Game/Graphics/UserInterface/KeyCounter.cs | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/KeyCounter.cs b/osu.Game/Graphics/UserInterface/KeyCounter.cs index a704c4c15b..4ac7ae017d 100644 --- a/osu.Game/Graphics/UserInterface/KeyCounter.cs +++ b/osu.Game/Graphics/UserInterface/KeyCounter.cs @@ -18,7 +18,19 @@ namespace osu.Game.Graphics.UserInterface public override string Name { get; } public bool IsCounting { get; set; } - public int Count { get; private set; } + private int count; + public int Count + { + get { return count; } + private set + { + if (count != value) + { + count = value; + countSpriteText.Text = value.ToString(@"#,0"); + } + } + } private bool isLit; public bool IsLit @@ -29,9 +41,9 @@ namespace osu.Game.Graphics.UserInterface if (isLit != value) { isLit = value; - UpdateGlowSprite(); + updateGlowSprite(value); if (value && IsCounting) - IncreaseCount(); + Count++; } } } @@ -95,24 +107,18 @@ namespace osu.Game.Graphics.UserInterface Width = buttonSprite.Width; } - private void UpdateGlowSprite() + private void updateGlowSprite(bool show) { - if (IsLit) + if (show) { glowSprite.FadeIn(FadeTime); textLayer.FadeColour(KeyDownTextColor, FadeTime); } else { - glowSprite.FadeOut(); + glowSprite.FadeOut(FadeTime); textLayer.FadeColour(KeyUpTextColor, FadeTime); } } - - private void IncreaseCount() - { - Count++; - countSpriteText.Text = Count.ToString(@"#,0"); - } } }