From 529cabb001bc16a68d8f306269f93d1d122710e3 Mon Sep 17 00:00:00 2001 From: smoogipooo Date: Fri, 10 Mar 2017 16:16:07 +0900 Subject: [PATCH] Make HudOverlay not dependent on Ruleset. --- osu.Game/Modes/UI/HudOverlay.cs | 7 +++---- osu.Game/Modes/UI/StandardHudOverlay.cs | 9 +-------- osu.Game/Screens/Play/Player.cs | 3 ++- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/osu.Game/Modes/UI/HudOverlay.cs b/osu.Game/Modes/UI/HudOverlay.cs index a9eaeb07b6..2a17b5efd7 100644 --- a/osu.Game/Modes/UI/HudOverlay.cs +++ b/osu.Game/Modes/UI/HudOverlay.cs @@ -10,7 +10,6 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Modes.Objects; using osu.Game.Screens.Play; using System; -using System.Collections.Generic; namespace osu.Game.Modes.UI { @@ -24,7 +23,7 @@ namespace osu.Game.Modes.UI private Bindable showKeyCounter; - protected abstract KeyCounterCollection CreateKeyCounter(IEnumerable keyCounters); + protected abstract KeyCounterCollection CreateKeyCounter(); protected abstract ComboCounter CreateComboCounter(); protected abstract PercentageCounter CreateAccuracyCounter(); protected abstract ScoreCounter CreateScoreCounter(); @@ -43,13 +42,13 @@ namespace osu.Game.Modes.UI AccuracyCounter?.Set(AccuracyCounter.Count - 0.01f); } - protected HudOverlay(Ruleset ruleset) + protected HudOverlay() { RelativeSizeAxes = Axes.Both; Children = new Drawable[] { - KeyCounter = CreateKeyCounter(ruleset.CreateGameplayKeys()), + KeyCounter = CreateKeyCounter(), ComboCounter = CreateComboCounter(), ScoreCounter = CreateScoreCounter(), AccuracyCounter = CreateAccuracyCounter(), diff --git a/osu.Game/Modes/UI/StandardHudOverlay.cs b/osu.Game/Modes/UI/StandardHudOverlay.cs index 03db6f0bda..f77191adf7 100644 --- a/osu.Game/Modes/UI/StandardHudOverlay.cs +++ b/osu.Game/Modes/UI/StandardHudOverlay.cs @@ -6,17 +6,11 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play; -using System.Collections.Generic; namespace osu.Game.Modes.UI { public class StandardHudOverlay : HudOverlay { - public StandardHudOverlay(Ruleset ruleset) - : base(ruleset) - { - } - protected override PercentageCounter CreateAccuracyCounter() => new PercentageCounter { Anchor = Anchor.TopCentre, @@ -39,14 +33,13 @@ namespace osu.Game.Modes.UI Margin = new MarginPadding { Top = 20 } }; - protected override KeyCounterCollection CreateKeyCounter(IEnumerable keyCounters) => new KeyCounterCollection + protected override KeyCounterCollection CreateKeyCounter() => new KeyCounterCollection { IsCounting = true, FadeTime = 50, Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Margin = new MarginPadding(10), - Children = keyCounters }; protected override ScoreCounter CreateScoreCounter() => new ScoreCounter(6) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 6a5f5f948e..1a71543786 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -112,7 +112,8 @@ namespace osu.Game.Screens.Play ruleset = Ruleset.GetRuleset(Beatmap.PlayMode); - hudOverlay = new StandardHudOverlay(ruleset); + hudOverlay = new StandardHudOverlay(); + hudOverlay.KeyCounter.Add(ruleset.CreateGameplayKeys()); hudOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor(beatmap.HitObjects.Count)); pauseOverlay = new PauseOverlay