mirror of https://github.com/ppy/osu
Move badge hierarchy declaration to constructor for safer access
This commit is contained in:
parent
1878578196
commit
4bb06873d5
|
@ -32,26 +32,22 @@ public Colour4 BadgeColour
|
||||||
set => badgeLabel.Colour = value;
|
set => badgeLabel.Colour = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
private OsuSpriteText badgeLabel = null!;
|
private readonly Box background;
|
||||||
|
private readonly OsuSpriteText badgeLabel;
|
||||||
|
|
||||||
protected BeatmapBadge()
|
protected BeatmapBadge()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
|
||||||
private void load(OsuColour colours, OverlayColourProvider? colourProvider)
|
|
||||||
{
|
|
||||||
InternalChild = new CircularContainer
|
InternalChild = new CircularContainer
|
||||||
{
|
{
|
||||||
Masking = true,
|
Masking = true,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
background = new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = colourProvider?.Background5 ?? colours.Gray2,
|
|
||||||
},
|
},
|
||||||
badgeLabel = new OsuSpriteText
|
badgeLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
@ -61,5 +57,11 @@ private void load(OsuColour colours, OverlayColourProvider? colourProvider)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(OsuColour colours, OverlayColourProvider? colourProvider)
|
||||||
|
{
|
||||||
|
background.Colour = colourProvider?.Background5 ?? colours.Gray2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue