1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 14:53:21 +08:00

Use format string for double instead of Math.Round.

This commit is contained in:
Huo Yaoyuan 2017-10-15 16:44:15 +08:00
parent 192ebe776f
commit 9b3676c562
3 changed files with 7 additions and 6 deletions

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapSet
beatmap = value;
var rate = (float)beatmap.OnlineInfo.PassCount / beatmap.OnlineInfo.PlayCount;
successPercent.Text = $"{Math.Round(rate * 100)}%";
successPercent.Text = rate.ToString("P0");
successRate.Length = rate;
percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic);

View File

@ -79,9 +79,10 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
[BackgroundDependencyLoader]
private void load(OsuColour colour, LocalisationEngine locale, BeatmapSetOverlay beatmapSetOverlay)
{
double pp = score.PP ?? 0;
stats.Add(new OsuSpriteText
{
Text = $"{Math.Round(score.PP ?? 0)}pp",
Text = $"{pp:0}pp",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
TextSize = 18,
@ -92,7 +93,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
stats.Add(new OsuSpriteText
{
Current = locale.Format($"weighted: {score.PP * weight ?? 0:0}pp ({weight:0%})"),
Text = $"weighted: {pp * weight:0}pp ({weight:P0})",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,
@ -103,7 +104,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
stats.Add(new OsuSpriteText
{
Text = "accuracy: " + score.Accuracy.ToString("0.00%"),
Text = $"accuracy: {score.Accuracy:P2}",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,

View File

@ -232,9 +232,9 @@ namespace osu.Game.Screens.Select
double bpmMax = beatmap.ControlPointInfo.BPMMaximum;
double bpmMin = beatmap.ControlPointInfo.BPMMinimum;
if (Precision.AlmostEquals(bpmMin, bpmMax)) return Math.Round(bpmMin) + "bpm";
if (Precision.AlmostEquals(bpmMin, bpmMax)) return $"{bpmMin:0}bpm";
return Math.Round(bpmMin) + "-" + Math.Round(bpmMax) + "bpm (mostly " + Math.Round(beatmap.ControlPointInfo.BPMMode) + "bpm)";
return $"{bpmMin:0}-{bpmMax:0}bpm (mostly {beatmap.ControlPointInfo.BPMMode:0}bpm)";
}
public class InfoLabel : Container