mirror of
https://github.com/ppy/osu
synced 2025-03-30 07:06:56 +00: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 System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -29,10 +30,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
|
private void load(OsuColour colours) => AccentColour = colours.BlueLighter;
|
||||||
|
|
||||||
protected override string FormatCount(double count)
|
protected override string FormatCount(double count) => count.FormatAccuracy();
|
||||||
{
|
|
||||||
return $@"{count:P2}";
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||||
{
|
{
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play.Break
|
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>
|
/// <summary>
|
||||||
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
||||||
/// Omits all decimal places when <paramref name="accuracy"/> equals 1d.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||||
/// <returns>formatted accuracy in percentage</returns>
|
/// <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>
|
/// <summary>
|
||||||
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
/// Turns the provided accuracy into a percentage with 2 decimal places.
|
||||||
/// Omits all decimal places when <paramref name="accuracy"/> equals 100m.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="accuracy">The accuracy to be formatted</param>
|
/// <param name="accuracy">The accuracy to be formatted</param>
|
||||||
/// <returns>formatted accuracy in percentage</returns>
|
/// <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