From 507f9642cc7db892326e4ca8a813063def813bba Mon Sep 17 00:00:00 2001 From: Givikap120 Date: Fri, 8 Sep 2023 22:15:30 +0300 Subject: [PATCH] Better counter formatization Now CS and HP have 1 decimal point precision, while AR and OD is kept with 2 because of future support of rate-changed AR/OD --- osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs | 8 ++++---- osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs | 9 ++++++--- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs b/osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs index b6a8dfe827..6a101bd9f9 100644 --- a/osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs +++ b/osu.Game/Overlays/Mods/ModEffectPreviewPanel.cs @@ -159,10 +159,10 @@ namespace osu.Game.Overlays.Mods Direction = FillDirection.Horizontal, Children = new[] { - circleSizeDisplay = new VerticalAttributeDisplay("CS"), - drainRateDisplay = new VerticalAttributeDisplay("HP"), - approachRateDisplay = new VerticalAttributeDisplay("AR"), - overallDifficultyDisplay = new VerticalAttributeDisplay("OD"), + circleSizeDisplay = new VerticalAttributeDisplay("CS", "0.#"), + drainRateDisplay = new VerticalAttributeDisplay("HP", "0.#"), + approachRateDisplay = new VerticalAttributeDisplay("AR", "0.##"), + overallDifficultyDisplay = new VerticalAttributeDisplay("OD", "0.##"), } } } diff --git a/osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs b/osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs index 95d979ebd2..503b07f3b9 100644 --- a/osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs +++ b/osu.Game/Overlays/Mods/VerticalAttributeDisplay.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Mods /// public LocalisableString Label { get; protected set; } - public VerticalAttributeDisplay(LocalisableString label) + public VerticalAttributeDisplay(LocalisableString label, string format = "0.#") { Label = label; AutoSizeAxes = Axes.X; @@ -54,7 +54,8 @@ namespace osu.Game.Overlays.Mods { Origin = Anchor.Centre, Anchor = Anchor.Centre, - Current = { BindTarget = Current } + Current = { BindTarget = Current }, + Format = format } } }; @@ -64,7 +65,9 @@ namespace osu.Game.Overlays.Mods { protected override double RollingDuration => 500; - protected override LocalisableString FormatCount(double count) => count.ToLocalisableString("0.##"); + public string Format = "0.#"; + + protected override LocalisableString FormatCount(double count) => count.ToLocalisableString(Format); protected override OsuSpriteText CreateSpriteText() => new OsuSpriteText {