1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:03:08 +08:00

Move column lines to background layer

This commit is contained in:
smoogipoo 2020-08-24 23:01:06 +09:00
parent 500cb0ccf5
commit 77bf646ea0

View File

@ -70,30 +70,27 @@ namespace osu.Game.Rulesets.Mania.Skinning
Color4 lightColour = GetColumnSkinConfig<Color4>(skin, LegacyManiaSkinConfigurationLookups.ColumnLightColour)?.Value Color4 lightColour = GetColumnSkinConfig<Color4>(skin, LegacyManiaSkinConfigurationLookups.ColumnLightColour)?.Value
?? Color4.White; ?? Color4.White;
Drawable background; Container backgroundLayer;
Drawable leftLine;
Drawable rightLine;
InternalChildren = new[] InternalChildren = new[]
{ {
background = new Box backgroundLayer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = backgroundColour Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = backgroundColour
},
}, },
hitTargetContainer = new Container hitTargetContainer = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new[] Children = new[]
{ {
// In legacy skins, the hit target takes on the full stage size and is sandwiched between the column background and the column light. leftLine = new Box
// To simulate this effect in lazer's hierarchy, the hit target is added to the first column's background and manually extended to the full size of the stage.
// Adding to the first columns allows depth issues to be resolved - if it were added to the last column, the previous column lights would appear below it.
// This still means that the hit target will appear below the next column backgrounds, but that's a much easier problem to solve by proxying the backgrounds below.
hitTarget = new LegacyHitTarget
{
RelativeSizeAxes = Axes.Y,
Alpha = hasHitTarget ? 1 : 0
},
new Box
{ {
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Width = leftLineWidth, Width = leftLineWidth,
@ -101,7 +98,7 @@ namespace osu.Game.Rulesets.Mania.Skinning
Colour = lineColour, Colour = lineColour,
Alpha = hasLeftLine ? 1 : 0 Alpha = hasLeftLine ? 1 : 0
}, },
new Box rightLine = new Box
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
@ -110,7 +107,16 @@ namespace osu.Game.Rulesets.Mania.Skinning
Scale = new Vector2(0.740f, 1), Scale = new Vector2(0.740f, 1),
Colour = lineColour, Colour = lineColour,
Alpha = hasRightLine ? 1 : 0 Alpha = hasRightLine ? 1 : 0
} },
// In legacy skins, the hit target takes on the full stage size and is sandwiched between the column background and the column light.
// To simulate this effect in lazer's hierarchy, the hit target is added to the first column's background and manually extended to the full size of the stage.
// Adding to the first columns allows depth issues to be resolved - if it were added to the last column, the previous column lights would appear below it.
// This still means that the hit target will appear below the next column backgrounds, but that's a much easier problem to solve by proxying the background layer below.
hitTarget = new LegacyHitTarget
{
RelativeSizeAxes = Axes.Y,
Alpha = hasHitTarget ? 1 : 0
},
} }
}, },
lightContainer = new Container lightContainer = new Container
@ -132,7 +138,9 @@ namespace osu.Game.Rulesets.Mania.Skinning
}; };
// Resolve depth issues with the hit target appearing under the next column backgrounds by proxying to the stage background (always below the columns). // Resolve depth issues with the hit target appearing under the next column backgrounds by proxying to the stage background (always below the columns).
stageBackground?.AddColumnBackground(background.CreateProxy()); backgroundLayer.Add(leftLine.CreateProxy());
backgroundLayer.Add(rightLine.CreateProxy());
stageBackground?.AddColumnBackground(backgroundLayer.CreateProxy());
direction.BindTo(scrollingInfo.Direction); direction.BindTo(scrollingInfo.Direction);
direction.BindValueChanged(onDirectionChanged, true); direction.BindValueChanged(onDirectionChanged, true);