mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 14:46:38 +09:00
Merge both variants of the star rating display
This commit is contained in:
@ -17,8 +17,12 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
public class StarRatingDisplayV2 : CompositeDrawable, IHasCurrentValue<StarDifficulty>
|
||||
/// <summary>
|
||||
/// A pill that displays the star rating of a beatmap.
|
||||
/// </summary>
|
||||
public class StarRatingDisplay : CompositeDrawable, IHasCurrentValue<StarDifficulty>
|
||||
{
|
||||
private readonly bool useNewDifficultyColours;
|
||||
private readonly Box background;
|
||||
private readonly SpriteIcon starIcon;
|
||||
private readonly OsuSpriteText starsText;
|
||||
@ -38,13 +42,18 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
private OverlayColourProvider colourProvider { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="StarRatingDisplayV2"/> using an already computed <see cref="StarDifficulty"/>.
|
||||
/// Creates a new <see cref="StarRatingDisplay"/> using an already computed <see cref="StarDifficulty"/>.
|
||||
/// </summary>
|
||||
/// <param name="starDifficulty">The already computed <see cref="StarDifficulty"/> to display the star difficulty of.</param>
|
||||
public StarRatingDisplayV2(StarDifficulty starDifficulty)
|
||||
/// <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, bool useNewDifficultyColours = false)
|
||||
{
|
||||
this.useNewDifficultyColours = useNewDifficultyColours;
|
||||
|
||||
Current.Value = starDifficulty;
|
||||
|
||||
Size = new Vector2(52f, 20f);
|
||||
|
||||
InternalChild = new CircularContainer
|
||||
{
|
||||
Masking = true,
|
||||
@ -82,7 +91,9 @@ namespace osu.Game.Beatmaps.Drawables
|
||||
{
|
||||
starsText.Text = c.NewValue.Stars.ToString("0.00");
|
||||
|
||||
background.Colour = colours.ForStarDifficulty(c.NewValue.Stars);
|
||||
background.Colour = useNewDifficultyColours
|
||||
? colours.ForStarDifficulty(c.NewValue.Stars)
|
||||
: colours.ForDifficultyRating(c.NewValue.DifficultyRating);
|
||||
|
||||
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);
|
Reference in New Issue
Block a user