mirror of
https://github.com/ppy/osu
synced 2025-03-06 03:19:47 +00:00
Remove beatmap-based ctor to promote single flow
This commit is contained in:
parent
cf69eacae9
commit
9141f48b04
@ -7,6 +7,7 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -51,7 +52,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(BeatmapDifficultyManager beatmapDifficultyManager)
|
||||
{
|
||||
var beatmap = score.Beatmap;
|
||||
var metadata = beatmap.BeatmapSet?.Metadata ?? beatmap.Metadata;
|
||||
@ -138,7 +139,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
Spacing = new Vector2(5, 0),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new StarRatingDisplay(beatmap)
|
||||
new StarRatingDisplay(beatmapDifficultyManager.GetDifficulty(beatmap, score.Ruleset, score.Mods))
|
||||
{
|
||||
Anchor = Anchor.CentreLeft,
|
||||
Origin = Anchor.CentreLeft
|
||||
|
@ -22,18 +22,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
/// </summary>
|
||||
public class StarRatingDisplay : CompositeDrawable
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
|
||||
private StarDifficulty? difficulty;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="StarRatingDisplay"/>.
|
||||
/// </summary>
|
||||
/// <param name="beatmap">The <see cref="BeatmapInfo"/> to display the star difficulty of.</param>
|
||||
public StarRatingDisplay(BeatmapInfo beatmap)
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
}
|
||||
private readonly StarDifficulty difficulty;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="StarRatingDisplay"/> using an already computed <see cref="StarDifficulty"/>.
|
||||
@ -49,17 +38,14 @@ namespace osu.Game.Screens.Ranking.Expanded
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
if (!difficulty.HasValue)
|
||||
difficulty = difficultyManager.GetDifficulty(beatmap);
|
||||
|
||||
var starRatingParts = difficulty.Value.Stars.ToString("0.00", CultureInfo.InvariantCulture).Split('.');
|
||||
var starRatingParts = difficulty.Stars.ToString("0.00", CultureInfo.InvariantCulture).Split('.');
|
||||
string wholePart = starRatingParts[0];
|
||||
string fractionPart = starRatingParts[1];
|
||||
string separator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
||||
|
||||
ColourInfo backgroundColour = difficulty.Value.DifficultyRating == DifficultyRating.ExpertPlus
|
||||
ColourInfo backgroundColour = difficulty.DifficultyRating == DifficultyRating.ExpertPlus
|
||||
? ColourInfo.GradientVertical(Color4Extensions.FromHex("#C1C1C1"), Color4Extensions.FromHex("#595959"))
|
||||
: (ColourInfo)colours.ForDifficultyRating(difficulty.Value.DifficultyRating);
|
||||
: (ColourInfo)colours.ForDifficultyRating(difficulty.DifficultyRating);
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user