2016-09-24 09:53:58 +08:00
|
|
|
|
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2016-09-24 10:04:08 +08:00
|
|
|
|
using System.Collections.Generic;
|
2016-09-24 09:53:58 +08:00
|
|
|
|
using OpenTK;
|
2016-09-24 10:26:42 +08:00
|
|
|
|
using OpenTK.Graphics;
|
2016-09-24 09:53:58 +08:00
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.UserInterface
|
|
|
|
|
{
|
|
|
|
|
public class KeyCounterCollection : FlowContainer
|
|
|
|
|
{
|
|
|
|
|
public KeyCounterCollection()
|
|
|
|
|
{
|
|
|
|
|
Direction = FlowDirection.HorizontalOnly;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-24 10:04:08 +08:00
|
|
|
|
private List<KeyCounter> counters = new List<KeyCounter>();
|
|
|
|
|
public IReadOnlyList<KeyCounter> Counters => counters;
|
|
|
|
|
|
2016-09-24 09:53:58 +08:00
|
|
|
|
public void AddKey(KeyCounter key)
|
|
|
|
|
{
|
2016-09-24 10:04:08 +08:00
|
|
|
|
counters.Add(key);
|
|
|
|
|
key.IsCounting = this.IsCounting;
|
2016-09-24 10:26:42 +08:00
|
|
|
|
key.FadeTime = this.FadeTime;
|
|
|
|
|
key.KeyDownTextColor = this.KeyDownTextColor;
|
|
|
|
|
key.KeyUpTextColor = this.KeyUpTextColor;
|
2016-09-24 09:53:58 +08:00
|
|
|
|
base.Add(key);
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-26 14:10:51 +08:00
|
|
|
|
public void ResetCount()
|
|
|
|
|
{
|
|
|
|
|
foreach (var counter in counters)
|
|
|
|
|
counter.ResetCount();
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-24 09:53:58 +08:00
|
|
|
|
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
|
|
|
|
2016-09-24 10:26:42 +08:00
|
|
|
|
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
|
2016-09-24 10:04:08 +08:00
|
|
|
|
private bool isCounting;
|
|
|
|
|
public bool IsCounting
|
|
|
|
|
{
|
|
|
|
|
get { return isCounting; }
|
|
|
|
|
set
|
|
|
|
|
{
|
2016-09-24 10:26:42 +08:00
|
|
|
|
if (value != isCounting)
|
|
|
|
|
{
|
|
|
|
|
isCounting = value;
|
|
|
|
|
foreach (var child in counters)
|
|
|
|
|
child.IsCounting = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private int fadeTime = 0;
|
|
|
|
|
public int FadeTime
|
|
|
|
|
{
|
|
|
|
|
get { return fadeTime; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value != fadeTime)
|
|
|
|
|
{
|
|
|
|
|
fadeTime = value;
|
|
|
|
|
foreach (var child in counters)
|
|
|
|
|
child.FadeTime = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Color4 keyDownTextColor = Color4.DarkGray;
|
|
|
|
|
public Color4 KeyDownTextColor
|
|
|
|
|
{
|
|
|
|
|
get { return keyDownTextColor; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value != keyDownTextColor)
|
|
|
|
|
{
|
|
|
|
|
keyDownTextColor = value;
|
|
|
|
|
foreach (var child in counters)
|
|
|
|
|
child.KeyDownTextColor = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Color4 keyUpTextColor = Color4.White;
|
|
|
|
|
public Color4 KeyUpTextColor
|
|
|
|
|
{
|
|
|
|
|
get { return keyUpTextColor; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value != keyUpTextColor)
|
|
|
|
|
{
|
|
|
|
|
keyUpTextColor = value;
|
|
|
|
|
foreach (var child in counters)
|
|
|
|
|
child.KeyUpTextColor = value;
|
|
|
|
|
}
|
2016-09-24 10:04:08 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2016-09-24 09:53:58 +08:00
|
|
|
|
}
|
|
|
|
|
}
|