1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 21:47:25 +08:00

Merge pull request #1378 from huoyaoyuan/text

Number text improvements
This commit is contained in:
Dean Herbert 2017-10-16 00:13:04 +09:00 committed by GitHub
commit 89d1f7e9c8
5 changed files with 9 additions and 12 deletions

View File

@ -1,7 +1,6 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -31,7 +30,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

@ -17,7 +17,6 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Users;
using System.Diagnostics;
using System.Globalization;
using System.Collections.Generic;
using osu.Framework.Graphics.Cursor;
@ -402,7 +401,7 @@ namespace osu.Game.Overlays.Profile
scoreText.Add(createScoreText("Ranked Score"));
scoreNumberText.Add(createScoreNumberText(user.Statistics.RankedScore.ToString(@"#,0")));
scoreText.Add(createScoreText("Accuracy"));
scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy.ToString("0.##", CultureInfo.CurrentCulture)}%"));
scoreNumberText.Add(createScoreNumberText($"{user.Statistics.Accuracy:0.##}%"));
scoreText.Add(createScoreText("Play Count"));
scoreNumberText.Add(createScoreNumberText(user.Statistics.PlayCount.ToString(@"#,0")));
scoreText.Add(createScoreText("Total Score"));

View File

@ -13,9 +13,7 @@ using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Select.Leaderboards;
using System.Linq;
using osu.Framework.Localisation;
using System.Globalization;
using osu.Game.Rulesets.Scoring;
using System;
using osu.Game.Rulesets.UI;
namespace osu.Game.Overlays.Profile.Sections.Ranks
@ -79,9 +77,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 +91,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
stats.Add(new OsuSpriteText
{
Text = $"weighted: {Math.Round(score.PP * weight ?? 0)}pp ({weight.Value.ToString("0%", CultureInfo.CurrentCulture)})",
Text = $"weighted: {pp * weight:0}pp ({weight:P0})",
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
Colour = colour.GrayA,
@ -103,7 +102,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

@ -155,7 +155,7 @@ namespace osu.Game.Overlays.Profile.Sections
{
missing.Hide();
foreach (OnlineScore score in scores)
scoreContainer.Add(new DrawableScore(score, includeWeigth ? Math.Pow(0.95, scoreContainer.Count) : -1)
scoreContainer.Add(new DrawableScore(score, includeWeigth ? Math.Pow(0.95, scoreContainer.Count) : (double?)null)
{
RelativeSizeAxes = Axes.X,
Height = 60,

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