Improve display of "total PP"

This commit is contained in:
Henry Lin
2022-01-18 22:11:43 +08:00
parent a5b53c01c8
commit 31e03e99cd
2 changed files with 9 additions and 3 deletions

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Difficulty
/// <returns></returns> /// <returns></returns>
public virtual IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay() public virtual IEnumerable<PerformanceDisplayAttribute> GetAttributesForDisplay()
{ {
yield return new PerformanceDisplayAttribute(nameof(Total), "Total", Total); yield return new PerformanceDisplayAttribute(nameof(Total), "Final PP", Total);
} }
} }
} }

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
@ -84,6 +85,11 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
float fraction = (float)(attribute.Value / perfectAttribute.Value); float fraction = (float)(attribute.Value / perfectAttribute.Value);
if (float.IsNaN(fraction)) if (float.IsNaN(fraction))
fraction = 0; fraction = 0;
string text = fraction.ToLocalisableString("0%").ToString();
if (isTotal)
text = (int)Math.Round(attribute.Value, MidpointRounding.AwayFromZero) + "/" + (int)Math.Round(perfectAttribute.Value, MidpointRounding.AwayFromZero);
return new GridContainer return new GridContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
@ -111,12 +117,12 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
}, },
new Bar new Bar
{ {
Alpha = isTotal ? 0 : 1,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Width = 130, Width = 130,
Height = 5, Height = 5,
BackgroundColour = Color4.White.Opacity(0.5f), BackgroundColour = Color4.White.Opacity(0.5f),
Colour = isTotal ? titleColor : textColour,
Length = fraction, Length = fraction,
Margin = new MarginPadding { Left = 5, Right = 5 } Margin = new MarginPadding { Left = 5, Right = 5 }
}, },
@ -125,7 +131,7 @@ namespace osu.Game.Screens.Ranking.Expanded.Statistics
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Font = OsuFont.GetFont(weight: FontWeight.SemiBold), Font = OsuFont.GetFont(weight: FontWeight.SemiBold),
Text = fraction.ToLocalisableString("0%"), Text = text,
Colour = isTotal ? titleColor : textColour Colour = isTotal ? titleColor : textColour
} }
} }