1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-15 14:42:56 +08:00

Move badge hierarchy declaration to constructor for safer access

This commit is contained in:
Salman Ahmed 2022-05-14 21:54:52 +03:00
parent 1878578196
commit 4bb06873d5

View File

@ -32,26 +32,22 @@ namespace osu.Game.Overlays.BeatmapSet
set => badgeLabel.Colour = value;
}
private OsuSpriteText badgeLabel = null!;
private readonly Box background;
private readonly OsuSpriteText badgeLabel;
protected BeatmapBadge()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, OverlayColourProvider? colourProvider)
{
InternalChild = new CircularContainer
{
Masking = true,
AutoSizeAxes = Axes.Both,
Children = new Drawable[]
{
new Box
background = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = colourProvider?.Background5 ?? colours.Gray2,
},
badgeLabel = new OsuSpriteText
{
@ -61,5 +57,11 @@ namespace osu.Game.Overlays.BeatmapSet
}
};
}
[BackgroundDependencyLoader(true)]
private void load(OsuColour colours, OverlayColourProvider? colourProvider)
{
background.Colour = colourProvider?.Background5 ?? colours.Gray2;
}
}
}