1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 10:22:54 +08:00

Update private methods implementation.

This commit is contained in:
Huo Yaoyuan 2016-09-26 14:07:43 +08:00
parent 756e7a6a67
commit b4bb3d6317

View File

@ -18,7 +18,19 @@ namespace osu.Game.Graphics.UserInterface
public override string Name { get; } public override string Name { get; }
public bool IsCounting { get; set; } 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; private bool isLit;
public bool IsLit public bool IsLit
@ -29,9 +41,9 @@ namespace osu.Game.Graphics.UserInterface
if (isLit != value) if (isLit != value)
{ {
isLit = value; isLit = value;
UpdateGlowSprite(); updateGlowSprite(value);
if (value && IsCounting) if (value && IsCounting)
IncreaseCount(); Count++;
} }
} }
} }
@ -95,24 +107,18 @@ namespace osu.Game.Graphics.UserInterface
Width = buttonSprite.Width; Width = buttonSprite.Width;
} }
private void UpdateGlowSprite() private void updateGlowSprite(bool show)
{ {
if (IsLit) if (show)
{ {
glowSprite.FadeIn(FadeTime); glowSprite.FadeIn(FadeTime);
textLayer.FadeColour(KeyDownTextColor, FadeTime); textLayer.FadeColour(KeyDownTextColor, FadeTime);
} }
else else
{ {
glowSprite.FadeOut(); glowSprite.FadeOut(FadeTime);
textLayer.FadeColour(KeyUpTextColor, FadeTime); textLayer.FadeColour(KeyUpTextColor, FadeTime);
} }
} }
private void IncreaseCount()
{
Count++;
countSpriteText.Text = Count.ToString(@"#,0");
}
} }
} }