From 25a920732fa6cba7c51ab1eaf44f16b0df79e627 Mon Sep 17 00:00:00 2001 From: OpenSauce04 Date: Thu, 12 Jan 2023 19:04:37 +0000 Subject: [PATCH] Addressed code formatting issues --- .../TestSceneDrumTouchInputArea.cs | 6 +++--- .../UI/DrumTouchInputArea.cs | 18 +++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs index 6b02b0078a..23b871dcd8 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestSceneDrumTouchInputArea.cs @@ -14,13 +14,13 @@ public partial class TestSceneDrumTouchInputArea : OsuTestScene { private DrumTouchInputArea drumTouchInputArea = null!; - private void createDrum(TaikoTouchControlScheme _forcedControlScheme) + private void createDrum(TaikoTouchControlScheme forcedControlScheme) { Child = new TaikoInputManager(new TaikoRuleset().RulesetInfo) { RelativeSizeAxes = Axes.Both, Children = new Drawable[] - { + { new InputDrum { Anchor = Anchor.TopCentre, @@ -31,7 +31,7 @@ private void createDrum(TaikoTouchControlScheme _forcedControlScheme) { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - ForceControlScheme = _forcedControlScheme + ForceControlScheme = forcedControlScheme } } }; diff --git a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs index 753b7f2da9..e4c20dd1bf 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrumTouchInputArea.cs @@ -25,6 +25,7 @@ namespace osu.Game.Rulesets.Taiko.UI public partial class DrumTouchInputArea : VisibilityContainer { public TaikoTouchControlScheme? ForceControlScheme { get; set; } + // visibility state affects our child. we always want to handle input. public override bool PropagatePositionalInputSubTree => true; public override bool PropagateNonPositionalInputSubTree => true; @@ -62,10 +63,12 @@ private DrumSegmentProperties getDrumSegmentProperties(int drumSegment) var taikoAction = getTaikoActionFromDrumSegment(drumSegment); return new DrumSegmentProperties(taikoAction, getColourFromTaikoAction(taikoAction)); } + [BackgroundDependencyLoader] private void load(TaikoInputManager taikoInputManager, TaikoRulesetConfigManager config) { Debug.Assert(taikoInputManager.KeyBindingContainer != null); + keyBindingContainer = taikoInputManager.KeyBindingContainer; // Container should handle input everywhere. @@ -187,14 +190,14 @@ private void handleDown(object source, Vector2 position) { Show(); - TaikoAction TaikoAction = getTaikoActionFromPosition(position); + TaikoAction taikoAction = getTaikoActionFromPosition(position); // Not too sure how this can happen, but let's avoid throwing. if (trackedActions.ContainsKey(source)) return; - trackedActions.Add(source, TaikoAction); - keyBindingContainer.TriggerPressed(TaikoAction); + trackedActions.Add(source, taikoAction); + keyBindingContainer.TriggerPressed(taikoAction); } private void handleUp(object source) @@ -236,20 +239,25 @@ private Color4 getColourFromTaikoAction(TaikoAction handledAction) { case TaikoAction.LeftRim: case TaikoAction.RightRim: + return colours.Blue; + case TaikoAction.LeftCentre: case TaikoAction.RightCentre: + return colours.Red; } + throw new ArgumentOutOfRangeException(); } + private partial class DrumSegment : CompositeDrawable, IKeyBindingHandler { private TaikoAction handledAction; - private Circle overlay; + private readonly Circle overlay; - private Circle circle; + private readonly Circle circle; public override bool Contains(Vector2 screenSpacePos) => circle.Contains(screenSpacePos);