From 0f663deda068ec41c2f5a5ef49e35d80d4c262e6 Mon Sep 17 00:00:00 2001
From: Dean Herbert <pe@ppy.sh>
Date: Thu, 22 Sep 2022 15:24:57 +0900
Subject: [PATCH] Fix changing shape causing alpha to be permanently reset to
 zero

---
 .../HUD/HitErrorMeters/ColourHitErrorMeter.cs | 28 +++++++++----------
 1 file changed, 13 insertions(+), 15 deletions(-)

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