From 17d1ecb8f592d5c630c17c49892720561bdf130c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 8 May 2017 19:42:36 +0300 Subject: [PATCH] Use float type for progress value --- osu.Game/Screens/Play/SongProgress.cs | 6 +++--- osu.Game/Screens/Play/SongProgressInfo.cs | 13 ++++--------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 6a0bc64de9..e3f96bd395 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -141,12 +141,12 @@ namespace osu.Game.Screens.Play return; double currentTime = (AudioClock?.CurrentTime ?? Time.Current) - firstHitTime; - double progress = currentTime / (lastHitTime - firstHitTime); + float progress = (float)(currentTime / (lastHitTime - firstHitTime)); - bar.UpdatePosition((float)progress); + bar.UpdatePosition(progress); graph.Progress = (int)(graph.ColumnCount * progress); - info.Progress = (int)(progress * 100); + info.Progress = progress; info.CurrentTime = currentTime; } } diff --git a/osu.Game/Screens/Play/SongProgressInfo.cs b/osu.Game/Screens/Play/SongProgressInfo.cs index cf73a0d10a..6719ddfb6b 100644 --- a/osu.Game/Screens/Play/SongProgressInfo.cs +++ b/osu.Game/Screens/Play/SongProgressInfo.cs @@ -15,11 +15,10 @@ namespace osu.Game.Screens.Play { private OsuSpriteText timeCurrent; private OsuSpriteText timeLeft; - private OsuSpriteText progressText; + private OsuSpriteText progress; private double currentTime; private double songLenght; - private int progress; private const int margin = 10; @@ -33,16 +32,12 @@ namespace osu.Game.Screens.Play timeCurrent.Text = TimeSpan.FromMilliseconds(value).ToString(@"m\:ss"); } } - public int Progress + public float Progress { set { - if (progress == value) - return; - - progress = value; if (currentTime > 0) - progressText.Text = value.ToString() + @"%"; + progress.Text = value.ToString("P0"); } } @@ -63,7 +58,7 @@ namespace osu.Game.Screens.Play }, Text = @"0:00", }, - progressText = new OsuSpriteText + progress = new OsuSpriteText { Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre,