1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +08:00

Use new difficulty colours permanently

This commit is contained in:
Salman Ahmed 2021-08-04 17:06:07 +03:00
parent 7f9af0ae65
commit b2332eb5b3
3 changed files with 7 additions and 41 deletions

View File

@ -14,34 +14,10 @@ namespace osu.Game.Tests.Visual.UserInterface
{ {
public class TestSceneStarRatingDisplay : OsuTestScene public class TestSceneStarRatingDisplay : OsuTestScene
{ {
[Test]
public void TestOldColoursDisplay()
{
AddStep("load displays", () => Child = new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
ChildrenEnumerable = new[]
{
1.23,
2.34,
3.45,
4.56,
5.67,
6.78,
10.11,
}.Select(starRating => new StarRatingDisplay(new StarDifficulty(starRating, 0))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre
})
});
}
[TestCase(52f, 20f)] [TestCase(52f, 20f)]
[TestCase(52f, 16f)] [TestCase(52f, 16f)]
[TestCase(50f, 14f)] [TestCase(50f, 14f)]
public void TestNewColoursDisplay(float width, float height) public void TestDisplay(float width, float height)
{ {
AddStep("load displays", () => AddStep("load displays", () =>
{ {
@ -59,7 +35,7 @@ namespace osu.Game.Tests.Visual.UserInterface
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(2f), Spacing = new Vector2(2f),
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
ChildrenEnumerable = Enumerable.Range(0, 10).Select(j => new StarRatingDisplay(new StarDifficulty(i + j * 0.1f, 0), true) ChildrenEnumerable = Enumerable.Range(0, 10).Select(j => new StarRatingDisplay(new StarDifficulty(i + j * 0.1f, 0))
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
@ -71,11 +47,11 @@ namespace osu.Game.Tests.Visual.UserInterface
} }
[Test] [Test]
public void TestChangingStarRatingDisplay([Values(false, true)] bool useNewColours) public void TestChangingStarRatingDisplay()
{ {
StarRatingDisplay starRating = null; StarRatingDisplay starRating = null;
AddStep("load display", () => Child = starRating = new StarRatingDisplay(new StarDifficulty(5.55, 1), useNewColours) AddStep("load display", () => Child = starRating = new StarRatingDisplay(new StarDifficulty(5.55, 1))
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,

View File

@ -22,7 +22,6 @@ namespace osu.Game.Beatmaps.Drawables
/// </summary> /// </summary>
public class StarRatingDisplay : CompositeDrawable, IHasCurrentValue<StarDifficulty> public class StarRatingDisplay : CompositeDrawable, IHasCurrentValue<StarDifficulty>
{ {
private readonly bool useNewDifficultyColours;
private readonly Box background; private readonly Box background;
private readonly SpriteIcon starIcon; private readonly SpriteIcon starIcon;
private readonly OsuSpriteText starsText; private readonly OsuSpriteText starsText;
@ -45,11 +44,8 @@ namespace osu.Game.Beatmaps.Drawables
/// Creates a new <see cref="StarRatingDisplay"/> using an already computed <see cref="StarDifficulty"/>. /// Creates a new <see cref="StarRatingDisplay"/> using an already computed <see cref="StarDifficulty"/>.
/// </summary> /// </summary>
/// <param name="starDifficulty">The already computed <see cref="StarDifficulty"/> to display.</param> /// <param name="starDifficulty">The already computed <see cref="StarDifficulty"/> to display.</param>
/// <param name="useNewDifficultyColours">Use the new spectrum-based difficulty colours for the display, rather than the old.</param> public StarRatingDisplay(StarDifficulty starDifficulty)
public StarRatingDisplay(StarDifficulty starDifficulty, bool useNewDifficultyColours = false)
{ {
this.useNewDifficultyColours = useNewDifficultyColours;
Current.Value = starDifficulty; Current.Value = starDifficulty;
Size = new Vector2(52f, 20f); Size = new Vector2(52f, 20f);
@ -92,9 +88,7 @@ namespace osu.Game.Beatmaps.Drawables
{ {
starsText.Text = c.NewValue.Stars.ToString("0.00"); starsText.Text = c.NewValue.Stars.ToString("0.00");
background.Colour = useNewDifficultyColours background.Colour = colours.ForStarDifficulty(c.NewValue.Stars);
? colours.ForStarDifficulty(c.NewValue.Stars)
: colours.ForDifficultyRating(c.NewValue.DifficultyRating);
starIcon.Colour = c.NewValue.Stars >= 6.5 ? colours.Orange1 : colourProvider?.Background5 ?? Color4Extensions.FromHex("303d47"); starIcon.Colour = c.NewValue.Stars >= 6.5 ? colours.Orange1 : colourProvider?.Background5 ?? Color4Extensions.FromHex("303d47");
starsText.Colour = c.NewValue.Stars >= 6.5 ? colours.Orange1 : colourProvider?.Background5 ?? Color4.Black.Opacity(0.75f); starsText.Colour = c.NewValue.Stars >= 6.5 ? colours.Orange1 : colourProvider?.Background5 ?? Color4.Black.Opacity(0.75f);

View File

@ -16,8 +16,6 @@ namespace osu.Game.Screens.OnlinePlay.Components
{ {
public class StarRatingRangeDisplay : OnlinePlayComposite public class StarRatingRangeDisplay : OnlinePlayComposite
{ {
private readonly bool useNewDifficultyColours;
[Resolved] [Resolved]
private OsuColour colours { get; set; } private OsuColour colours { get; set; }
@ -26,10 +24,8 @@ namespace osu.Game.Screens.OnlinePlay.Components
private StarRatingDisplay maxDisplay; private StarRatingDisplay maxDisplay;
private Drawable maxBackground; private Drawable maxBackground;
public StarRatingRangeDisplay(bool useNewDifficultyColours = false) public StarRatingRangeDisplay()
{ {
this.useNewDifficultyColours = useNewDifficultyColours;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
} }