mirror of
https://github.com/ppy/osu.git
synced 2026-05-16 19:13:59 +08:00
Make edits based on reviews
This commit is contained in:
@@ -20,14 +20,14 @@ namespace osu.Game.Localisation
|
||||
public static LocalisableString UnstableRateTitle => new TranslatableString(getKey(@"unstable_rate_title"), @"Unstable Rate");
|
||||
|
||||
/// <summary>
|
||||
/// "early"
|
||||
/// "{0} ms early"
|
||||
/// </summary>
|
||||
public static LocalisableString Early => new TranslatableString(getKey(@"early"), @"early");
|
||||
public static LocalisableString Early(string offset) => new TranslatableString(getKey(@"early"), @"{0} ms early", offset);
|
||||
|
||||
/// <summary>
|
||||
/// "late"
|
||||
/// "{0} ms late"
|
||||
/// </summary>
|
||||
public static LocalisableString Late => new TranslatableString(getKey(@"late"), @"late");
|
||||
public static LocalisableString Late(string offset) => new TranslatableString(getKey(@"late"), @"{0} ms late", offset);
|
||||
|
||||
/// <summary>
|
||||
/// "(not available)"
|
||||
|
||||
@@ -24,8 +24,14 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
Value = hitEvents.CalculateAverageHitError();
|
||||
}
|
||||
|
||||
protected override LocalisableString DisplayValue(double? value) => value == null
|
||||
? RankingStatisticsStrings.NotAvailable
|
||||
: $"{Math.Abs(value.Value):N2} ms {(value.Value < 0 ? RankingStatisticsStrings.Early : RankingStatisticsStrings.Late)}";
|
||||
protected override LocalisableString DisplayValue(double? value)
|
||||
{
|
||||
return value == null ? RankingStatisticsStrings.NotAvailable : getEarlyLateText(value.Value);
|
||||
|
||||
LocalisableString getEarlyLateText(double offset) =>
|
||||
offset < 0
|
||||
? RankingStatisticsStrings.Early(Math.Abs(offset).ToString(@"N2"))
|
||||
: RankingStatisticsStrings.Late(Math.Abs(offset).ToString(@"N2"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// 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.
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Localisation;
|
||||
@@ -92,7 +94,13 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
/// Used to convert <see cref="Value"/> to a text representation.
|
||||
/// Defaults to using <see cref="object.ToString"/>.
|
||||
/// </summary>
|
||||
protected virtual LocalisableString DisplayValue(TValue value) => value!.ToString() ?? string.Empty;
|
||||
protected virtual LocalisableString DisplayValue(TValue value)
|
||||
{
|
||||
if (value is IFormattable formattable)
|
||||
return formattable.ToLocalisableString();
|
||||
|
||||
return value!.ToString() ?? string.Empty;
|
||||
}
|
||||
|
||||
public SimpleStatisticItem(LocalisableString name)
|
||||
: base(name)
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
@@ -23,6 +24,6 @@ namespace osu.Game.Screens.Ranking.Statistics
|
||||
Value = hitEvents.CalculateUnstableRate()?.Result;
|
||||
}
|
||||
|
||||
protected override LocalisableString DisplayValue(double? value) => value?.ToString(@"N2") ?? RankingStatisticsStrings.NotAvailable;
|
||||
protected override LocalisableString DisplayValue(double? value) => value?.ToLocalisableString(@"N2") ?? RankingStatisticsStrings.NotAvailable;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user