1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 17:52:56 +08:00

Handle pitch black background case

This commit is contained in:
Salman Ahmed 2021-08-04 01:40:39 +03:00
parent 9a5e052dc0
commit b5970d5cdc

View File

@ -23,6 +23,7 @@ namespace osu.Game.Screens.Ranking.Expanded
public class StarRatingDisplay : CompositeDrawable, IHasCurrentValue<StarDifficulty>
{
private Box background;
private FillFlowContainer content;
private OsuTextFlowContainer textFlow;
[Resolved]
@ -64,7 +65,7 @@ namespace osu.Game.Screens.Ranking.Expanded
},
}
},
new FillFlowContainer
content = new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Padding = new MarginPadding { Horizontal = 8, Vertical = 4 },
@ -78,7 +79,6 @@ namespace osu.Game.Screens.Ranking.Expanded
Origin = Anchor.CentreLeft,
Size = new Vector2(7),
Icon = FontAwesome.Solid.Star,
Colour = Color4.Black
},
textFlow = new OsuTextFlowContainer(s => s.Font = OsuFont.Numeric.With(weight: FontWeight.Black))
{
@ -107,19 +107,20 @@ namespace osu.Game.Screens.Ranking.Expanded
string fractionPart = starRatingParts[1];
string separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
background.Colour = colours.ForStarDifficulty(Current.Value.Stars);
var stars = Current.Value.Stars;
background.Colour = colours.ForStarDifficulty(stars);
content.Colour = stars >= 6.5 ? colours.Orange1 : Color4.Black;
textFlow.Clear();
textFlow.AddText($"{wholePart}", s =>
{
s.Colour = Color4.Black;
s.Font = s.Font.With(size: 14);
s.UseFullGlyphHeight = false;
});
textFlow.AddText($"{separator}{fractionPart}", s =>
{
s.Colour = Color4.Black;
s.Font = s.Font.With(size: 7);
s.UseFullGlyphHeight = false;
});