1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Reorder taiko playfield elements to fix hit explosion Z-ordering

This commit is contained in:
Salman Ahmed 2022-04-06 02:37:51 +03:00
parent e4f6e842b0
commit ec5ad995f8

View File

@ -48,8 +48,8 @@ namespace osu.Game.Rulesets.Taiko.UI
private readonly IDictionary<HitResult, HitExplosionPool> explosionPools = new Dictionary<HitResult, HitExplosionPool>();
private ProxyContainer topLevelHitContainer;
private InputDrum inputDrum;
private Container rightArea;
private Container leftArea;
/// <remarks>
/// <see cref="Playfield.AddNested"/> is purposefully not called on this to prevent i.e. being able to interact
@ -57,14 +57,36 @@ namespace osu.Game.Rulesets.Taiko.UI
/// </remarks>
private BarLinePlayfield barLinePlayfield;
private Container hitTargetOffsetContent;
private Container playfieldContent;
private Container playfieldOverlay;
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Container leftArea = null;
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()),
}
},
mascot = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Mascot), _ => Empty())
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.TopLeft,
RelativePositionAxes = Axes.Y,
RelativeSizeAxes = Axes.None,
Y = 0.2f
},
rightArea = new Container
{
Name = "Right area",
@ -74,7 +96,7 @@ namespace osu.Game.Rulesets.Taiko.UI
{
new Container
{
Name = "Masked elements before hit objects",
Name = "Elements before hit objects",
RelativeSizeAxes = Axes.Both,
FillMode = FillMode.Fit,
Children = new[]
@ -89,22 +111,28 @@ namespace osu.Game.Rulesets.Taiko.UI
}
}
},
hitTargetOffsetContent = new Container
new Container
{
Name = "Masked hit objects content",
RelativeSizeAxes = Axes.Both,
Masking = true,
Child = playfieldContent = new Container
{
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
barLinePlayfield = new BarLinePlayfield(),
HitObjectContainer,
}
}
},
playfieldOverlay = new Container
{
Name = "Elements after hit objects",
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
barLinePlayfield = new BarLinePlayfield(),
new Container
{
Name = "Hit objects",
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
HitObjectContainer,
drumRollHitContainer = new DrumRollHitContainer()
}
},
drumRollHitContainer = new DrumRollHitContainer(),
kiaiExplosionContainer = new Container<KiaiHitExplosion>
{
Name = "Kiai hit explosions",
@ -120,38 +148,21 @@ namespace osu.Game.Rulesets.Taiko.UI
},
}
},
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()),
new InputDrum(HitObjectContainer)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
}
},
mascot = new SkinnableDrawable(new TaikoSkinComponent(TaikoSkinComponents.Mascot), _ => Empty())
{
Origin = Anchor.BottomLeft,
Anchor = Anchor.TopLeft,
RelativePositionAxes = Axes.Y,
RelativeSizeAxes = Axes.None,
Y = 0.2f
},
topLevelHitContainer = new ProxyContainer
{
Name = "Top level hit objects",
RelativeSizeAxes = Axes.Both,
},
drumRollHitContainer.CreateProxy(),
inputDrum = new InputDrum(HitObjectContainer)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
},
};
leftArea.Add(inputDrum.CreateProxy());
RegisterPool<Hit, DrawableHit>(50);
RegisterPool<Hit.StrongNestedHit, DrawableHit.StrongNestedHit>(50);
@ -196,8 +207,10 @@ namespace osu.Game.Rulesets.Taiko.UI
// Padding is required to be updated for elements which are based on "absolute" X sized elements.
// This is basically allowing for correct alignment as relative pieces move around them.
rightArea.Padding = new MarginPadding { Left = leftArea.DrawWidth - (ClassicHitTargetPosition.Value ? 45 : 0) };
hitTargetOffsetContent.Padding = new MarginPadding { Left = HitTarget.DrawWidth / 2 };
var inputDrumSize = inputDrum.Skinnable.Drawable.ToSpaceOfOtherDrawable(inputDrum.Skinnable.Drawable.DrawSize, this);
rightArea.Padding = new MarginPadding { Left = inputDrumSize.X };
playfieldContent.Padding = new MarginPadding { Left = HitTarget.DrawWidth / 2 };
playfieldOverlay.Padding = new MarginPadding { Left = HitTarget.DrawWidth / 2 };
mascot.Scale = new Vector2(DrawHeight / DEFAULT_HEIGHT);
}