mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 00:09:55 +09:00
Fix score displays using non-matching zero padding depending on user score display mode
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
// 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 osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
@ -17,20 +18,19 @@ namespace osu.Game.Graphics.UserInterface
|
||||
/// </summary>
|
||||
public bool UseCommaSeparator { get; }
|
||||
|
||||
/// <summary>
|
||||
/// How many leading zeroes the counter has.
|
||||
/// </summary>
|
||||
public uint LeadingZeroes { get; }
|
||||
public Bindable<int> RequiredDisplayDigits { get; } = new Bindable<int>();
|
||||
|
||||
/// <summary>
|
||||
/// Displays score.
|
||||
/// </summary>
|
||||
/// <param name="leading">How many leading zeroes the counter will have.</param>
|
||||
/// <param name="useCommaSeparator">Whether comma separators should be displayed.</param>
|
||||
protected ScoreCounter(uint leading = 0, bool useCommaSeparator = false)
|
||||
protected ScoreCounter(int leading = 0, bool useCommaSeparator = false)
|
||||
{
|
||||
UseCommaSeparator = useCommaSeparator;
|
||||
LeadingZeroes = leading;
|
||||
|
||||
RequiredDisplayDigits.Value = leading;
|
||||
RequiredDisplayDigits.BindValueChanged(_ => UpdateDisplay());
|
||||
}
|
||||
|
||||
protected override double GetProportionalDuration(double currentValue, double newValue)
|
||||
@ -40,7 +40,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
|
||||
protected override string FormatCount(double count)
|
||||
{
|
||||
string format = new string('0', (int)LeadingZeroes);
|
||||
string format = new string('0', RequiredDisplayDigits.Value);
|
||||
|
||||
if (UseCommaSeparator)
|
||||
{
|
||||
|
Reference in New Issue
Block a user