1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Inline input drum proxying logic

This commit is contained in:
Salman Ahmed 2022-04-13 04:38:07 +03:00
parent b84a3b7834
commit f48533b8a2

View File

@ -63,27 +63,27 @@ namespace osu.Game.Rulesets.Taiko.UI
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours) 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[] InternalChildren = new[]
{ {
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()), new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()),
leftArea = new Container new Container
{ {
Name = "Left overlay", Name = "Left overlay",
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,
BorderColour = colours.Gray0, BorderColour = colours.Gray0,
Children = new Drawable[] Children = new[]
{ {
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()), new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()),
inputDrum = new InputDrum(HitObjectContainer) inputDrum.CreateProxy(),
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y,
},
} }
}, },
mascot = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Mascot), _ => Empty()) mascot = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Mascot), _ => Empty())
@ -161,15 +161,11 @@ namespace osu.Game.Rulesets.Taiko.UI
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
drumRollHitContainer.CreateProxy(), 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<Hit, DrawableHit>(50); RegisterPool<Hit, DrawableHit>(50);
RegisterPool<Hit.StrongNestedHit, DrawableHit.StrongNestedHit>(50); RegisterPool<Hit.StrongNestedHit, DrawableHit.StrongNestedHit>(50);