2016-09-24 01:53:58 +00: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 02:04:08 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-09-24 01:53:58 +00:00
|
|
|
|
using OpenTK;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.UserInterface
|
|
|
|
|
{
|
|
|
|
|
public class KeyCounterCollection : FlowContainer
|
|
|
|
|
{
|
|
|
|
|
public KeyCounterCollection()
|
|
|
|
|
{
|
|
|
|
|
Direction = FlowDirection.HorizontalOnly;
|
|
|
|
|
}
|
|
|
|
|
|
2016-09-24 02:04:08 +00:00
|
|
|
|
private List<KeyCounter> counters = new List<KeyCounter>();
|
|
|
|
|
//default capacity is 4, and osu! uses 4 keys usually, so it won't trouble
|
|
|
|
|
public IReadOnlyList<KeyCounter> Counters => counters;
|
|
|
|
|
|
2016-09-24 01:53:58 +00:00
|
|
|
|
public void AddKey(KeyCounter key)
|
|
|
|
|
{
|
2016-09-24 02:04:08 +00:00
|
|
|
|
counters.Add(key);
|
|
|
|
|
key.IsCounting = this.IsCounting;
|
2016-09-24 01:53:58 +00:00
|
|
|
|
base.Add(key);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
|
|
|
|
2016-09-24 02:04:08 +00:00
|
|
|
|
private bool isCounting;
|
|
|
|
|
public bool IsCounting
|
|
|
|
|
{
|
|
|
|
|
get { return isCounting; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
isCounting = value;
|
|
|
|
|
foreach (var child in counters)
|
|
|
|
|
child.IsCounting = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-09-24 01:53:58 +00:00
|
|
|
|
}
|
|
|
|
|
}
|