1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 01:32:55 +08:00

Fix changing shape causing alpha to be permanently reset to zero

This commit is contained in:
Dean Herbert 2022-09-22 15:24:57 +09:00
parent ae70b2c32f
commit 0f663deda0

View File

@ -112,6 +112,8 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
private readonly Color4 colour; private readonly Color4 colour;
private Container content = null!;
public HitErrorShape(Color4 colour, int size) public HitErrorShape(Color4 colour, int size)
{ {
this.colour = colour; this.colour = colour;
@ -122,33 +124,29 @@ namespace osu.Game.Screens.Play.HUD.HitErrorMeters
{ {
base.LoadComplete(); base.LoadComplete();
Child = content = new Container
{
RelativeSizeAxes = Axes.Both,
Colour = colour
};
Shape.BindValueChanged(shape => Shape.BindValueChanged(shape =>
{ {
switch (shape.NewValue) switch (shape.NewValue)
{ {
case ShapeStyle.Circle: case ShapeStyle.Circle:
Child = new Circle content.Child = new Circle { RelativeSizeAxes = Axes.Both };
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
Colour = colour
};
break; break;
case ShapeStyle.Square: case ShapeStyle.Square:
Child = new Box content.Child = new Box { RelativeSizeAxes = Axes.Both };
{
RelativeSizeAxes = Axes.Both,
Alpha = 0,
Colour = colour
};
break; break;
} }
}, true); }, true);
Child.FadeInFromZero(animation_duration, Easing.OutQuint); content.FadeInFromZero(animation_duration, Easing.OutQuint);
Child.MoveToY(-DrawSize.Y); content.MoveToY(-DrawSize.Y);
Child.MoveToY(0, animation_duration, Easing.OutQuint); content.MoveToY(0, animation_duration, Easing.OutQuint);
} }
public void Remove() public void Remove()