mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 03:22:57 +08:00
Support displaying "unranked PP" placeholder
This commit is contained in:
parent
4be4ed7ab2
commit
6b7ffc240b
@ -180,10 +180,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
|
|
||||||
if (showPerformancePoints)
|
if (showPerformancePoints)
|
||||||
{
|
{
|
||||||
if (score.PP != null)
|
if (!score.Ranked)
|
||||||
content.Add(new StatisticText(score.PP, format: @"N0"));
|
content.Add(new UnrankedPerformancePointsPlaceholder { Font = OsuFont.GetFont(size: text_size) });
|
||||||
else
|
else if (score.PP == null)
|
||||||
content.Add(new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(text_size) });
|
content.Add(new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(text_size) });
|
||||||
|
else
|
||||||
|
content.Add(new StatisticText(score.PP, format: @"N0"));
|
||||||
}
|
}
|
||||||
|
|
||||||
content.Add(new ScoreboardTime(score.Date, text_size)
|
content.Add(new ScoreboardTime(score.Date, text_size)
|
||||||
|
@ -125,10 +125,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
|
|
||||||
ppColumn.Alpha = value.BeatmapInfo!.Status.GrantsPerformancePoints() ? 1 : 0;
|
ppColumn.Alpha = value.BeatmapInfo!.Status.GrantsPerformancePoints() ? 1 : 0;
|
||||||
|
|
||||||
if (value.PP is double pp)
|
if (!value.Ranked)
|
||||||
ppColumn.Text = pp.ToLocalisableString(@"N0");
|
ppColumn.Drawable = new UnrankedPerformancePointsPlaceholder { Font = smallFont };
|
||||||
else
|
else if (value.PP is not double pp)
|
||||||
ppColumn.Drawable = new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(smallFont.Size) };
|
ppColumn.Drawable = new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(smallFont.Size) };
|
||||||
|
else
|
||||||
|
ppColumn.Text = pp.ToLocalisableString(@"N0");
|
||||||
|
|
||||||
statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn);
|
statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn);
|
||||||
modsColumn.Mods = value.Mods;
|
modsColumn.Mods = value.Mods;
|
||||||
|
@ -216,7 +216,18 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
if (!Score.PP.HasValue)
|
if (!Score.PP.HasValue)
|
||||||
{
|
{
|
||||||
if (Score.Beatmap?.Status.GrantsPerformancePoints() == true)
|
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 UnprocessedPerformancePointsPlaceholder { Size = new Vector2(16), Colour = colourProvider.Highlight1 };
|
||||||
|
}
|
||||||
|
|
||||||
return new OsuSpriteText
|
return new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
|
||||||
|
namespace osu.Game.Scoring.Drawables
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A placeholder used in PP columns for scores that do not award PP.
|
||||||
|
/// </summary>
|
||||||
|
public partial class UnrankedPerformancePointsPlaceholder : SpriteText, IHasTooltip
|
||||||
|
{
|
||||||
|
public LocalisableString TooltipText => "pp is not awarded for this score"; // todo: replace with localised string ScoresStrings.StatusNoPp.
|
||||||
|
|
||||||
|
public UnrankedPerformancePointsPlaceholder()
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre;
|
||||||
|
Origin = Anchor.Centre;
|
||||||
|
Text = "-";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user