mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Fix beatmap overlay leaderboard not handling null PP scores properly
This commit is contained in:
parent
2205e0dc3d
commit
7c477e6f22
@ -6,7 +6,6 @@
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
@ -178,10 +177,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (showPerformancePoints)
|
if (showPerformancePoints)
|
||||||
{
|
content.Add(new StatisticText(score.PP, format: @"N0"));
|
||||||
Debug.Assert(score.PP != null);
|
|
||||||
content.Add(new StatisticText(score.PP.Value, format: @"N0"));
|
|
||||||
}
|
|
||||||
|
|
||||||
content.Add(new ScoreboardTime(score.Date, text_size)
|
content.Add(new ScoreboardTime(score.Date, text_size)
|
||||||
{
|
{
|
||||||
@ -222,19 +218,19 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
|||||||
|
|
||||||
private class StatisticText : OsuSpriteText, IHasTooltip
|
private class StatisticText : OsuSpriteText, IHasTooltip
|
||||||
{
|
{
|
||||||
private readonly double count;
|
private readonly double? count;
|
||||||
private readonly double? maxCount;
|
private readonly double? maxCount;
|
||||||
private readonly bool showTooltip;
|
private readonly bool showTooltip;
|
||||||
|
|
||||||
public LocalisableString TooltipText => maxCount == null || !showTooltip ? string.Empty : $"{count}/{maxCount}";
|
public LocalisableString TooltipText => maxCount == null || !showTooltip ? string.Empty : $"{count}/{maxCount}";
|
||||||
|
|
||||||
public StatisticText(double count, double? maxCount = null, string format = null, bool showTooltip = true)
|
public StatisticText(double? count, double? maxCount = null, string format = null, bool showTooltip = true)
|
||||||
{
|
{
|
||||||
this.count = count;
|
this.count = count;
|
||||||
this.maxCount = maxCount;
|
this.maxCount = maxCount;
|
||||||
this.showTooltip = showTooltip;
|
this.showTooltip = showTooltip;
|
||||||
|
|
||||||
Text = count.ToLocalisableString(format);
|
Text = count?.ToLocalisableString(format) ?? default;
|
||||||
Font = OsuFont.GetFont(size: text_size);
|
Font = OsuFont.GetFont(size: text_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user