From 9a5e052dc08c4eae30de3b2021f97cfdc19837b9 Mon Sep 17 00:00:00 2001 From: Salman Ahmed Date: Tue, 3 Aug 2021 14:17:02 +0300 Subject: [PATCH] Use star difficulty colour spectrum game-wide --- osu.Game/Beatmaps/Drawables/DifficultyIcon.cs | 6 ++--- osu.Game/Graphics/OsuColour.cs | 25 ------------------- .../Components/StarRatingRangeDisplay.cs | 4 +-- .../Ranking/Expanded/StarRatingDisplay.cs | 4 +-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- 5 files changed, 7 insertions(+), 34 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs index c62b803d1a..9a3c75dcc6 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyIcon.cs @@ -106,7 +106,7 @@ namespace osu.Game.Beatmaps.Drawables Child = background = new Box { RelativeSizeAxes = Axes.Both, - Colour = colours.ForDifficultyRating(beatmap.DifficultyRating) // Default value that will be re-populated once difficulty calculation completes + Colour = colours.ForStarDifficulty(beatmap.StarDifficulty) // Default value that will be re-populated once difficulty calculation completes }, }, new ConstrainedIconContainer @@ -124,7 +124,7 @@ namespace osu.Game.Beatmaps.Drawables else difficultyBindable.Value = new StarDifficulty(beatmap.StarDifficulty, 0); - difficultyBindable.BindValueChanged(difficulty => background.Colour = colours.ForDifficultyRating(difficulty.NewValue.DifficultyRating)); + difficultyBindable.BindValueChanged(difficulty => background.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars)); } public ITooltip GetCustomTooltip() => new DifficultyIconTooltip(); @@ -271,7 +271,7 @@ namespace osu.Game.Beatmaps.Drawables starDifficulty.BindValueChanged(difficulty => { starRating.Text = $"{difficulty.NewValue.Stars:0.##}"; - difficultyFlow.Colour = colours.ForDifficultyRating(difficulty.NewValue.DifficultyRating, true); + difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars); }, true); return true; diff --git a/osu.Game/Graphics/OsuColour.cs b/osu.Game/Graphics/OsuColour.cs index 4eb9aa7c94..222300d018 100644 --- a/osu.Game/Graphics/OsuColour.cs +++ b/osu.Game/Graphics/OsuColour.cs @@ -18,31 +18,6 @@ namespace osu.Game.Graphics public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255); public Color4 ForDifficultyRating(DifficultyRating difficulty, bool useLighterColour = false) - { - switch (difficulty) - { - case DifficultyRating.Easy: - return Green; - - default: - case DifficultyRating.Normal: - return Blue; - - case DifficultyRating.Hard: - return Yellow; - - case DifficultyRating.Insane: - return Pink; - - case DifficultyRating.Expert: - return PurpleLight; - - case DifficultyRating.ExpertPlus: - return useLighterColour ? Gray9 : Color4Extensions.FromHex("#121415"); - } - } - - public Color4 ForDifficultyRatingNew(DifficultyRating difficulty) { switch (difficulty) { diff --git a/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs b/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs index b2e35d7020..8c1b10e3bd 100644 --- a/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs +++ b/osu.Game/Screens/OnlinePlay/Components/StarRatingRangeDisplay.cs @@ -86,8 +86,8 @@ namespace osu.Game.Screens.OnlinePlay.Components minDisplay.Current.Value = minDifficulty; maxDisplay.Current.Value = maxDifficulty; - minBackground.Colour = colours.ForDifficultyRating(minDifficulty.DifficultyRating, true); - maxBackground.Colour = colours.ForDifficultyRating(maxDifficulty.DifficultyRating, true); + minBackground.Colour = colours.ForStarDifficulty(minDifficulty.Stars); + maxBackground.Colour = colours.ForStarDifficulty(maxDifficulty.Stars); } } } diff --git a/osu.Game/Screens/Ranking/Expanded/StarRatingDisplay.cs b/osu.Game/Screens/Ranking/Expanded/StarRatingDisplay.cs index e59a0de316..9d325768f3 100644 --- a/osu.Game/Screens/Ranking/Expanded/StarRatingDisplay.cs +++ b/osu.Game/Screens/Ranking/Expanded/StarRatingDisplay.cs @@ -107,9 +107,7 @@ namespace osu.Game.Screens.Ranking.Expanded string fractionPart = starRatingParts[1]; string separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator; - var rating = Current.Value.DifficultyRating; - - background.Colour = colours.ForDifficultyRating(rating, true); + background.Colour = colours.ForStarDifficulty(Current.Value.Stars); textFlow.Clear(); textFlow.AddText($"{wholePart}", s => diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 763c27bcbb..3779523094 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -503,7 +503,7 @@ namespace osu.Game.Screens.Select { const float full_opacity_ratio = 0.7f; - var difficultyColour = colours.ForDifficultyRating(difficulty.DifficultyRating); + var difficultyColour = colours.ForStarDifficulty(difficulty.Stars); Children = new Drawable[] {