mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 10:33:30 +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 (score.PP != null)
|
||||
content.Add(new StatisticText(score.PP, format: @"N0"));
|
||||
else
|
||||
if (!score.Ranked)
|
||||
content.Add(new UnrankedPerformancePointsPlaceholder { Font = OsuFont.GetFont(size: text_size) });
|
||||
else if (score.PP == null)
|
||||
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)
|
||||
|
@ -125,10 +125,12 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
|
||||
ppColumn.Alpha = value.BeatmapInfo!.Status.GrantsPerformancePoints() ? 1 : 0;
|
||||
|
||||
if (value.PP is double pp)
|
||||
ppColumn.Text = pp.ToLocalisableString(@"N0");
|
||||
else
|
||||
if (!value.Ranked)
|
||||
ppColumn.Drawable = new UnrankedPerformancePointsPlaceholder { Font = smallFont };
|
||||
else if (value.PP is not double pp)
|
||||
ppColumn.Drawable = new UnprocessedPerformancePointsPlaceholder { Size = new Vector2(smallFont.Size) };
|
||||
else
|
||||
ppColumn.Text = pp.ToLocalisableString(@"N0");
|
||||
|
||||
statisticsColumns.ChildrenEnumerable = value.GetStatisticsForDisplay().Select(createStatisticsColumn);
|
||||
modsColumn.Mods = value.Mods;
|
||||
|
@ -216,7 +216,18 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||
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
|
||||
{
|
||||
|
@ -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