Remove alignment logic completely for the time being

This was overly complex and does not play well with the new layout
customisation system. We can add it back as required.
This commit is contained in:
Dean Herbert 2021-05-18 14:50:10 +09:00
parent 7137315fa7
commit 829d326e36

View File

@ -20,8 +20,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
{ {
public class BarHitErrorMeter : HitErrorMeter public class BarHitErrorMeter : HitErrorMeter
{ {
private readonly Anchor alignment;
private const int arrow_move_duration = 400; private const int arrow_move_duration = 400;
private const int judgement_line_width = 6; private const int judgement_line_width = 6;
@ -45,9 +43,6 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
public BarHitErrorMeter() public BarHitErrorMeter()
{ {
// todo: investigate.
alignment = false ? Anchor.x0 : Anchor.x2;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
} }
@ -63,33 +58,42 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
Margin = new MarginPadding(2), Margin = new MarginPadding(2),
Children = new Drawable[] Children = new Drawable[]
{ {
judgementsContainer = new Container new Container
{ {
Anchor = Anchor.y1 | alignment, Anchor = Anchor.CentreLeft,
Origin = Anchor.y1 | alignment, Origin = Anchor.CentreLeft,
Width = judgement_line_width, Width = chevron_size,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Child = arrow = new SpriteIcon
{
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre,
RelativePositionAxes = Axes.Y,
Y = 0.5f,
Icon = FontAwesome.Solid.ChevronRight,
Size = new Vector2(chevron_size),
}
}, },
colourBars = new Container colourBars = new Container
{ {
Width = bar_width, Width = bar_width,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Anchor = Anchor.y1 | alignment, Anchor = Anchor.CentreLeft,
Origin = Anchor.y1 | alignment, Origin = Anchor.CentreLeft,
Children = new Drawable[] Children = new Drawable[]
{ {
colourBarsEarly = new Container colourBarsEarly = new Container
{ {
Anchor = Anchor.y1 | alignment, Anchor = Anchor.CentreLeft,
Origin = alignment, Origin = Anchor.x2,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.5f, Height = 0.5f,
Scale = new Vector2(1, -1), Scale = new Vector2(1, -1),
}, },
colourBarsLate = new Container colourBarsLate = new Container
{ {
Anchor = Anchor.y1 | alignment, Anchor = Anchor.CentreLeft,
Origin = alignment, Origin = Anchor.x2,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Height = 0.5f, Height = 0.5f,
}, },
@ -115,21 +119,12 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
} }
} }
}, },
new Container judgementsContainer = new Container
{ {
Anchor = Anchor.y1 | alignment, Anchor = Anchor.CentreLeft,
Origin = Anchor.y1 | alignment, Origin = Anchor.CentreLeft,
Width = chevron_size, Width = judgement_line_width,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Child = arrow = new SpriteIcon
{
Anchor = Anchor.TopCentre,
Origin = Anchor.Centre,
RelativePositionAxes = Axes.Y,
Y = 0.5f,
Icon = alignment == Anchor.x2 ? FontAwesome.Solid.ChevronRight : FontAwesome.Solid.ChevronLeft,
Size = new Vector2(chevron_size),
}
}, },
} }
}; };
@ -167,7 +162,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
// a little nub to mark the centre point. // a little nub to mark the centre point.
var centre = createColourBar(windows.Last().result, 0.01f); var centre = createColourBar(windows.Last().result, 0.01f);
centre.Anchor = centre.Origin = Anchor.y1 | (alignment == Anchor.x2 ? Anchor.x0 : Anchor.x2); centre.Anchor = centre.Origin = Anchor.CentreLeft;
centre.Width = 2.5f; centre.Width = 2.5f;
colourBars.Add(centre); colourBars.Add(centre);
@ -239,8 +234,7 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
judgementsContainer.Add(new JudgementLine judgementsContainer.Add(new JudgementLine
{ {
Y = getRelativeJudgementPosition(judgement.TimeOffset), Y = getRelativeJudgementPosition(judgement.TimeOffset),
Anchor = alignment == Anchor.x2 ? Anchor.x0 : Anchor.x2, Origin = Anchor.CentreLeft,
Origin = Anchor.y1 | (alignment == Anchor.x2 ? Anchor.x0 : Anchor.x2),
}); });
arrow.MoveToY( arrow.MoveToY(