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

Use star difficulty colour spectrum game-wide

This commit is contained in:
Salman Ahmed 2021-08-03 14:17:02 +03:00
parent 6fd97d67eb
commit 9a5e052dc0
5 changed files with 7 additions and 34 deletions

View File

@ -106,7 +106,7 @@ namespace osu.Game.Beatmaps.Drawables
Child = background = new Box Child = background = new Box
{ {
RelativeSizeAxes = Axes.Both, 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 new ConstrainedIconContainer
@ -124,7 +124,7 @@ namespace osu.Game.Beatmaps.Drawables
else else
difficultyBindable.Value = new StarDifficulty(beatmap.StarDifficulty, 0); 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(); public ITooltip GetCustomTooltip() => new DifficultyIconTooltip();
@ -271,7 +271,7 @@ namespace osu.Game.Beatmaps.Drawables
starDifficulty.BindValueChanged(difficulty => starDifficulty.BindValueChanged(difficulty =>
{ {
starRating.Text = $"{difficulty.NewValue.Stars:0.##}"; starRating.Text = $"{difficulty.NewValue.Stars:0.##}";
difficultyFlow.Colour = colours.ForDifficultyRating(difficulty.NewValue.DifficultyRating, true); difficultyFlow.Colour = colours.ForStarDifficulty(difficulty.NewValue.Stars);
}, true); }, true);
return true; return true;

View File

@ -18,31 +18,6 @@ namespace osu.Game.Graphics
public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255); public static Color4 Gray(byte amt) => new Color4(amt, amt, amt, 255);
public Color4 ForDifficultyRating(DifficultyRating difficulty, bool useLighterColour = false) 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) switch (difficulty)
{ {

View File

@ -86,8 +86,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
minDisplay.Current.Value = minDifficulty; minDisplay.Current.Value = minDifficulty;
maxDisplay.Current.Value = maxDifficulty; maxDisplay.Current.Value = maxDifficulty;
minBackground.Colour = colours.ForDifficultyRating(minDifficulty.DifficultyRating, true); minBackground.Colour = colours.ForStarDifficulty(minDifficulty.Stars);
maxBackground.Colour = colours.ForDifficultyRating(maxDifficulty.DifficultyRating, true); maxBackground.Colour = colours.ForStarDifficulty(maxDifficulty.Stars);
} }
} }
} }

View File

@ -107,9 +107,7 @@ 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;
var rating = Current.Value.DifficultyRating; background.Colour = colours.ForStarDifficulty(Current.Value.Stars);
background.Colour = colours.ForDifficultyRating(rating, true);
textFlow.Clear(); textFlow.Clear();
textFlow.AddText($"{wholePart}", s => textFlow.AddText($"{wholePart}", s =>

View File

@ -503,7 +503,7 @@ namespace osu.Game.Screens.Select
{ {
const float full_opacity_ratio = 0.7f; const float full_opacity_ratio = 0.7f;
var difficultyColour = colours.ForDifficultyRating(difficulty.DifficultyRating); var difficultyColour = colours.ForStarDifficulty(difficulty.Stars);
Children = new Drawable[] Children = new Drawable[]
{ {