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

Fix crashing TestSceneMedalOverlay (#7388)

Fix crashing TestSceneMedalOverlay

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2020-01-07 14:07:36 +09:00 committed by GitHub
commit 8dceaa6e8b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 102 additions and 91 deletions

View File

@ -41,11 +41,17 @@ namespace osu.Game.Overlays
private SampleChannel getSample;
private readonly Container content;
public MedalOverlay(Medal medal)
{
this.medal = medal;
RelativeSizeAxes = Axes.Both;
Child = content = new Container
{
Alpha = 0,
RelativeSizeAxes = Axes.Both,
Children = new Drawable[]
{
background = new Box
@ -139,7 +145,10 @@ namespace osu.Game.Overlays
},
},
},
}
};
Show();
}
[BackgroundDependencyLoader]
@ -154,19 +163,22 @@ namespace osu.Game.Overlays
Colour = colours.Blue.Opacity(0.5f),
Radius = 50,
};
disc.Add(drawableMedal = new DrawableMedal(medal)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Both,
});
}
protected override void LoadComplete()
{
base.LoadComplete();
Show();
LoadComponentAsync(drawableMedal = new DrawableMedal(medal)
{
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
RelativeSizeAxes = Axes.Both,
}, loaded =>
{
disc.Add(loaded);
startAnimation();
});
}
protected override void Update()
@ -190,11 +202,10 @@ namespace osu.Game.Overlays
private const double initial_duration = 400;
private const double step_duration = 900;
protected override void PopIn()
private void startAnimation()
{
base.PopIn();
content.Show();
this.FadeIn(200);
background.FlashColour(Color4.White.Opacity(0.25f), 400);
getSample.Play();

View File

@ -51,7 +51,7 @@ namespace osu.Game.Overlays.MedalSplash
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Scale = new Vector2(0.81f),
Scale = new Vector2(0.41f),
},
medalGlow = new Sprite
{