mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 12:02:54 +08:00
Merge pull request #7763 from TheWildTree/fix-accuracy-format
Make accuracy formatting more consistent
This commit is contained in:
commit
023c807530
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
@ -29,10 +30,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
|
||||
|
||||
protected override string FormatCount(double count)
|
||||
{
|
||||
return $@"{count:P2}";
|
||||
}
|
||||
protected override string FormatCount(double count) => count.FormatAccuracy();
|
||||
|
||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||
{
|
||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Screens.Play.Break
|
||||
{
|
||||
@ -85,6 +86,6 @@ namespace osu.Game.Screens.Play.Break
|
||||
{
|
||||
}
|
||||
|
||||
protected override string Format(double count) => $@"{count:P2}";
|
||||
protected override string Format(double count) => count.FormatAccuracy();
|
||||
}
|
||||
}
|
||||
|
@ -7,18 +7,16 @@ namespace osu.Game.Utils
|
||||
{
|
||||
/// <summary>
|
||||
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
||||
/// Omits all decimal places when <paramref name="accuracy"/> equals 1d.
|
||||
/// </summary>
|
||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||
/// <returns>formatted accuracy in percentage</returns>
|
||||
public static string FormatAccuracy(this double accuracy) => accuracy == 1 ? "100%" : $"{accuracy:0.00%}";
|
||||
public static string FormatAccuracy(this double accuracy) => $"{accuracy:0.00%}";
|
||||
|
||||
/// <summary>
|
||||
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
||||
/// Omits all decimal places when <paramref name="accuracy"/> equals 100m.
|
||||
/// </summary>
|
||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||
/// <returns>formatted accuracy in percentage</returns>
|
||||
public static string FormatAccuracy(this decimal accuracy) => accuracy == 100 ? "100%" : $"{accuracy:0.00}%";
|
||||
public static string FormatAccuracy(this decimal accuracy) => $"{accuracy:0.00}%";
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user