1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 18:37:52 +08:00

Adjust tooltip text format

This commit is contained in:
CloneWith 2024-10-04 16:56:16 +08:00
parent 2d7fdaf892
commit fd5655455a
No known key found for this signature in database
GPG Key ID: F4FC0D1E91D7FFD5

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
using osu.Framework.Input.Events; using osu.Framework.Input.Events;
using osu.Framework.Localisation; using osu.Framework.Localisation;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Extensions;
using osu.Game.Graphics; using osu.Game.Graphics;
using osuTK; using osuTK;
@ -38,8 +37,9 @@ namespace osu.Game.Screens.Play.HUD
private float relativePositionX; private float relativePositionX;
public LocalisableString TooltipText => $"{(relativePositionX > 0 ? (EndTime - StartTime) * relativePositionX / DrawWidth : relativePositionX > DrawWidth ? EndTime : 0).ToEditorFormattedString()}" public LocalisableString TooltipText => $"{formatTime(TimeSpan.FromSeconds(relativePositionX > 0 ? Math.Round((EndTime - StartTime) * relativePositionX / DrawWidth / 1000)
+ $" - {(relativePositionX > 0 ? Math.Round(relativePositionX / DrawWidth * 100, 2) : relativePositionX > DrawWidth ? 100 : 0)}%"; : relativePositionX > DrawWidth ? Math.Round(EndTime / 1000) : 0))}"
+ $" - {(relativePositionX > 0 ? Math.Round(relativePositionX / DrawWidth * 100, 1) : relativePositionX > DrawWidth ? 100 : 0)}%";
public ArgonSongProgressBar(float barHeight) public ArgonSongProgressBar(float barHeight)
{ {
@ -191,5 +191,7 @@ namespace osu.Game.Screens.Play.HUD
set => fill.Colour = value; set => fill.Colour = value;
} }
} }
private string formatTime(TimeSpan timeSpan) => $"{(timeSpan < TimeSpan.Zero ? "-" : "")}{Math.Floor(timeSpan.Duration().TotalMinutes)}:{timeSpan.Duration().Seconds:D2}";
} }
} }