From ba19fe1b9751918d3d7646832bcc7582c42ee7e2 Mon Sep 17 00:00:00 2001 From: Huo Yaoyuan Date: Fri, 23 Sep 2016 19:14:11 +0800 Subject: [PATCH] Move IsCounting to KeyCounter. --- osu.Game/Graphics/UserInterface/Counter.cs | 4 ++-- osu.Game/Graphics/UserInterface/KeyCounter.cs | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/Counter.cs b/osu.Game/Graphics/UserInterface/Counter.cs index 17e0f65f0d..5296bef1c0 100644 --- a/osu.Game/Graphics/UserInterface/Counter.cs +++ b/osu.Game/Graphics/UserInterface/Counter.cs @@ -17,7 +17,7 @@ namespace osu.Game.Graphics.UserInterface private SpriteText countSpriteText; public override string Name { get; } - public bool IsCounting { get; set; } + public KeyCounter ParentCounter { get; set; } public int Counts { get; private set; } private bool isLit; @@ -26,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface get { return isLit; } set { - if (value && !isLit && IsCounting) + if (value && !isLit && ParentCounter.IsCounting) IncreaseCount(); if (isLit != value) { diff --git a/osu.Game/Graphics/UserInterface/KeyCounter.cs b/osu.Game/Graphics/UserInterface/KeyCounter.cs index dad7c84745..3b974be19c 100644 --- a/osu.Game/Graphics/UserInterface/KeyCounter.cs +++ b/osu.Game/Graphics/UserInterface/KeyCounter.cs @@ -13,8 +13,14 @@ namespace osu.Game.Graphics.UserInterface Direction = FlowDirection.HorizontalOnly; } - public void AddKey(Count key) => base.Add(key); + public void AddKey(Count key) + { + key.ParentCounter = this; + base.Add(key); + } public override bool Contains(Vector2 screenSpacePos) => true; + + public bool IsCounting { get; set; } } }