1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 22:33:05 +08:00

Flip ifs to reduce nesting

This commit is contained in:
Bartłomiej Dach 2024-02-07 13:36:46 +01:00
parent 9a3c947319
commit f22828bc50
No known key found for this signature in database

View File

@ -213,30 +213,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
private Drawable createDrawablePerformance() private Drawable createDrawablePerformance()
{ {
if (!Score.PP.HasValue) if (Score.PP.HasValue)
{ {
if (Score.Beatmap?.Status.GrantsPerformancePoints() == true)
{
if (!Score.Ranked)
{
return new UnrankedPerformancePointsPlaceholder
{
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Colour = colourProvider.Highlight1
};
}
return new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(16), Colour = colourProvider.Highlight1 };
}
return new OsuSpriteText
{
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Text = "-",
Colour = colourProvider.Highlight1
};
}
return new FillFlowContainer return new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
@ -263,6 +241,28 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
}; };
} }
if (Score.Beatmap?.Status.GrantsPerformancePoints() != true)
{
return new OsuSpriteText
{
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Text = "-",
Colour = colourProvider.Highlight1
};
}
if (!Score.Ranked)
{
return new UnrankedPerformancePointsPlaceholder
{
Font = OsuFont.GetFont(weight: FontWeight.Bold),
Colour = colourProvider.Highlight1
};
}
return new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(16), Colour = colourProvider.Highlight1 };
}
private partial class ScoreBeatmapMetadataContainer : BeatmapMetadataContainer private partial class ScoreBeatmapMetadataContainer : BeatmapMetadataContainer
{ {
public ScoreBeatmapMetadataContainer(IBeatmapInfo beatmapInfo) public ScoreBeatmapMetadataContainer(IBeatmapInfo beatmapInfo)