osu/osu.Game/Graphics/UserInterface/KeyCounterCollection.cs

98 lines
2.8 KiB
C#
Raw Normal View History

//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
2016-10-22 10:37:27 +00:00
using osu.Framework.Graphics;
using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Graphics.Containers;
namespace osu.Game.Graphics.UserInterface
{
2016-12-03 07:58:27 +00:00
public class KeyCounterCollection : FlowContainer<KeyCounter>
{
public KeyCounterCollection()
{
Direction = FlowDirection.HorizontalOnly;
2016-10-22 10:37:27 +00:00
AutoSizeAxes = Axes.Both;
}
2016-12-03 07:58:27 +00:00
public override void Add(KeyCounter key)
2016-10-06 14:33:09 +00:00
{
2016-12-03 07:58:27 +00:00
base.Add(key);
key.IsCounting = IsCounting;
key.FadeTime = FadeTime;
key.KeyDownTextColor = KeyDownTextColor;
key.KeyUpTextColor = KeyUpTextColor;
}
2016-09-26 06:10:51 +00:00
public void ResetCount()
{
2016-12-03 07:58:27 +00:00
foreach (var counter in Children)
2016-09-26 06:10:51 +00:00
counter.ResetCount();
}
public override bool Contains(Vector2 screenSpacePos) => true;
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
private bool isCounting;
public bool IsCounting
{
get { return isCounting; }
set
{
if (value != isCounting)
{
isCounting = value;
2016-12-03 07:58:27 +00:00
foreach (var child in Children)
child.IsCounting = value;
}
}
}
private int fadeTime = 0;
public int FadeTime
{
get { return fadeTime; }
set
{
if (value != fadeTime)
{
fadeTime = value;
2016-12-03 07:58:27 +00:00
foreach (var child in Children)
child.FadeTime = value;
}
}
}
private Color4 keyDownTextColor = Color4.DarkGray;
public Color4 KeyDownTextColor
{
get { return keyDownTextColor; }
set
{
if (value != keyDownTextColor)
{
keyDownTextColor = value;
2016-12-03 07:58:27 +00:00
foreach (var child in Children)
child.KeyDownTextColor = value;
}
}
}
private Color4 keyUpTextColor = Color4.White;
public Color4 KeyUpTextColor
{
get { return keyUpTextColor; }
set
{
if (value != keyUpTextColor)
{
keyUpTextColor = value;
2016-12-03 07:58:27 +00:00
foreach (var child in Children)
child.KeyUpTextColor = value;
}
}
}
}
}