diff --git a/osu.Game/Screens/Ranking/Expanded/StarRatingDisplay.cs b/osu.Game/Screens/Ranking/Expanded/StarRatingDisplay.cs
index 4b38b298f1..402ab99908 100644
--- a/osu.Game/Screens/Ranking/Expanded/StarRatingDisplay.cs
+++ b/osu.Game/Screens/Ranking/Expanded/StarRatingDisplay.cs
@@ -24,6 +24,8 @@ namespace osu.Game.Screens.Ranking.Expanded
{
private readonly BeatmapInfo beatmap;
+ private StarDifficulty? difficulty;
+
///
/// Creates a new .
///
@@ -31,20 +33,33 @@ namespace osu.Game.Screens.Ranking.Expanded
public StarRatingDisplay(BeatmapInfo beatmap)
{
this.beatmap = beatmap;
- AutoSizeAxes = Axes.Both;
+ }
+
+ ///
+ /// Creates a new using an already computed .
+ ///
+ /// The already computed to display the star difficulty of.
+ public StarRatingDisplay(StarDifficulty starDifficulty)
+ {
+ difficulty = starDifficulty;
}
[BackgroundDependencyLoader]
- private void load(OsuColour colours)
+ private void load(OsuColour colours, BeatmapDifficultyManager difficultyManager)
{
- var starRatingParts = beatmap.StarDifficulty.ToString("0.00", CultureInfo.InvariantCulture).Split('.');
+ AutoSizeAxes = Axes.Both;
+
+ if (!difficulty.HasValue)
+ difficulty = difficultyManager.GetDifficulty(beatmap);
+
+ var starRatingParts = difficulty.Value.Stars.ToString("0.00", CultureInfo.InvariantCulture).Split('.');
string wholePart = starRatingParts[0];
string fractionPart = starRatingParts[1];
string separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
- ColourInfo backgroundColour = beatmap.DifficultyRating == DifficultyRating.ExpertPlus
+ ColourInfo backgroundColour = difficulty.Value.DifficultyRating == DifficultyRating.ExpertPlus
? ColourInfo.GradientVertical(Color4Extensions.FromHex("#C1C1C1"), Color4Extensions.FromHex("#595959"))
- : (ColourInfo)colours.ForDifficultyRating(beatmap.DifficultyRating);
+ : (ColourInfo)colours.ForDifficultyRating(difficulty.Value.DifficultyRating);
InternalChildren = new Drawable[]
{
diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs
index 6085e266d7..bdfcc2fd96 100644
--- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs
+++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs
@@ -238,7 +238,7 @@ namespace osu.Game.Screens.Select
Shear = wedged_container_shear,
Children = new[]
{
- createStarRatingDisplay(beatmapInfo).With(display =>
+ createStarRatingDisplay(starDifficulty).With(display =>
{
display.Anchor = Anchor.TopRight;
display.Origin = Anchor.TopRight;
@@ -305,8 +305,8 @@ namespace osu.Game.Screens.Select
StatusPill.Hide();
}
- private static Drawable createStarRatingDisplay(BeatmapInfo beatmapInfo) => beatmapInfo.StarDifficulty > 0
- ? new StarRatingDisplay(beatmapInfo)
+ private static Drawable createStarRatingDisplay(StarDifficulty difficulty) => difficulty.Stars > 0
+ ? new StarRatingDisplay(difficulty)
{
Margin = new MarginPadding { Bottom = 5 }
}