From f48533b8a292d95202f1a3833e1569391c5a160a Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Wed, 13 Apr 2022 04:38:07 +0300 Subject: [PATCH] Inline input drum proxying logic --- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 30 +++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 5891672f29..d75e3fb303 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -63,27 +63,27 @@ namespace osu.Game.Rulesets.Taiko.UI [BackgroundDependencyLoader] private void load(OsuColour colours) { - Container leftArea; + inputDrum = new InputDrum(HitObjectContainer) + { + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + AutoSizeAxes = Axes.X, + RelativeSizeAxes = Axes.Y, + }; InternalChildren = new[] { new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()), - leftArea = new Container + new Container { Name = "Left overlay", RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, BorderColour = colours.Gray0, - Children = new Drawable[] + Children = new[] { new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()), - inputDrum = new InputDrum(HitObjectContainer) - { - Anchor = Anchor.CentreLeft, - Origin = Anchor.CentreLeft, - AutoSizeAxes = Axes.X, - RelativeSizeAxes = Axes.Y, - }, + inputDrum.CreateProxy(), } }, mascot = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Mascot), _ => Empty()) @@ -161,15 +161,11 @@ namespace osu.Game.Rulesets.Taiko.UI RelativeSizeAxes = Axes.Both, }, drumRollHitContainer.CreateProxy(), + // this is added at the end of the hierarchy to receive input before taiko objects. + // but is proxied below everything to not cover visual effects such as hit explosions. + inputDrum, }; - // to prioritise receiving key presses on input drum before objects, move input drum to the end of the hierarchy... - leftArea.Remove(inputDrum); - AddInternal(inputDrum); - - // ...and create a proxy to keep the input drum displayed behind the playfield elements. - leftArea.Add(inputDrum.CreateProxy()); - RegisterPool(50); RegisterPool(50);