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