mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 21:12:55 +08:00
Counter animation.
This commit is contained in:
parent
81f269ee69
commit
409bb0d068
@ -2,6 +2,7 @@
|
|||||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
@ -26,11 +27,18 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value && !isLit && IsCounting)
|
if (value && !isLit && IsCounting)
|
||||||
Counts++;
|
IncreaseCount();
|
||||||
isLit = value;
|
if (isLit != value)
|
||||||
|
{
|
||||||
|
isLit = value;
|
||||||
|
UpdateGlowSprite();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Color4 KeyDownTextColor { get; set; } = Color4.DarkGray;
|
||||||
|
public Color4 KeyUpTextColor { get; set; } = Color4.White;
|
||||||
|
|
||||||
protected Count(string name)
|
protected Count(string name)
|
||||||
{
|
{
|
||||||
Name = name;
|
Name = name;
|
||||||
@ -61,17 +69,42 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
Text = Name,
|
Text = Name,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Position = new Vector2(0, -buttonSprite.Height / 4)
|
Position = new Vector2(0, -buttonSprite.Height / 4),
|
||||||
|
Colour = KeyUpTextColor
|
||||||
},
|
},
|
||||||
countSpriteText = new SpriteText
|
countSpriteText = new SpriteText
|
||||||
{
|
{
|
||||||
Text = Counts.ToString(),
|
Text = Counts.ToString(),
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Position = new Vector2(0, buttonSprite.Height / 4)
|
Position = new Vector2(0, buttonSprite.Height / 4),
|
||||||
|
Colour = KeyUpTextColor
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
glowSprite.Hide();
|
glowSprite.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateGlowSprite()
|
||||||
|
{
|
||||||
|
//can have a FadeTime property or const
|
||||||
|
if (IsLit)
|
||||||
|
{
|
||||||
|
glowSprite.Show();
|
||||||
|
countSpriteText.FadeColour(KeyDownTextColor, 0);
|
||||||
|
keySpriteText.FadeColour(KeyDownTextColor, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glowSprite.Hide();
|
||||||
|
countSpriteText.FadeColour(KeyUpTextColor, 0);
|
||||||
|
keySpriteText.FadeColour(KeyUpTextColor, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void IncreaseCount()
|
||||||
|
{
|
||||||
|
Counts++;
|
||||||
|
countSpriteText.Text = Counts.ToString();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user