mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:52:55 +08:00
Fix crashing TestSceneMedalOverlay (#7388)
Fix crashing TestSceneMedalOverlay Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
8dceaa6e8b
@ -41,11 +41,17 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
private SampleChannel getSample;
|
private SampleChannel getSample;
|
||||||
|
|
||||||
|
private readonly Container content;
|
||||||
|
|
||||||
public MedalOverlay(Medal medal)
|
public MedalOverlay(Medal medal)
|
||||||
{
|
{
|
||||||
this.medal = medal;
|
this.medal = medal;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Child = content = new Container
|
||||||
|
{
|
||||||
|
Alpha = 0,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new Box
|
background = new Box
|
||||||
@ -139,7 +145,10 @@ namespace osu.Game.Overlays
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -154,19 +163,22 @@ namespace osu.Game.Overlays
|
|||||||
Colour = colours.Blue.Opacity(0.5f),
|
Colour = colours.Blue.Opacity(0.5f),
|
||||||
Radius = 50,
|
Radius = 50,
|
||||||
};
|
};
|
||||||
|
|
||||||
disc.Add(drawableMedal = new DrawableMedal(medal)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.TopCentre,
|
|
||||||
Origin = Anchor.TopCentre,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.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()
|
protected override void Update()
|
||||||
@ -190,11 +202,10 @@ namespace osu.Game.Overlays
|
|||||||
private const double initial_duration = 400;
|
private const double initial_duration = 400;
|
||||||
private const double step_duration = 900;
|
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);
|
background.FlashColour(Color4.White.Opacity(0.25f), 400);
|
||||||
|
|
||||||
getSample.Play();
|
getSample.Play();
|
||||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Overlays.MedalSplash
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Scale = new Vector2(0.81f),
|
Scale = new Vector2(0.41f),
|
||||||
},
|
},
|
||||||
medalGlow = new Sprite
|
medalGlow = new Sprite
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user