1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 16:47:46 +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;
InternalChildren = new[]
{
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()),
leftArea = new Container
{
Name = "Left overlay",
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
BorderColour = colours.Gray0,
Children = new Drawable[]
{
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()),
inputDrum = new InputDrum(HitObjectContainer) inputDrum = new InputDrum(HitObjectContainer)
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
}, };
InternalChildren = new[]
{
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundRight), _ => new PlayfieldBackgroundRight()),
new Container
{
Name = "Left overlay",
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
BorderColour = colours.Gray0,
Children = new[]
{
new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.PlayfieldBackgroundLeft), _ => new PlayfieldBackgroundLeft()),
inputDrum.CreateProxy(),
} }
}, },
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);