From d55c97a08ad2cf93127022523d853c24700d1eaa Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Thu, 11 May 2017 01:48:46 +0300 Subject: [PATCH] Stop progress as soon as we at 100% --- osu.Game/Screens/Play/SongProgress.cs | 7 +++-- osu.Game/Screens/Play/SongProgressInfo.cs | 35 ++++++++++++----------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 548befdb36..c10248e97d 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -145,8 +145,11 @@ namespace osu.Game.Screens.Play double progress = ((audioClock?.CurrentTime ?? Time.Current) - firstHitTime) / (lastHitTime - firstHitTime); - bar.UpdatePosition((float)progress); - graph.Progress = (int)(graph.ColumnCount * progress); + if((int)progress * 100 < 100) + { + bar.UpdatePosition((float)progress); + graph.Progress = (int)(graph.ColumnCount * progress); + } } } } diff --git a/osu.Game/Screens/Play/SongProgressInfo.cs b/osu.Game/Screens/Play/SongProgressInfo.cs index 88ef358fbc..2767e4ec63 100644 --- a/osu.Game/Screens/Play/SongProgressInfo.cs +++ b/osu.Game/Screens/Play/SongProgressInfo.cs @@ -75,28 +75,31 @@ namespace osu.Game.Screens.Play double songCurrentTime = AudioClock.CurrentTime - startTime; - int currentSecond = TimeSpan.FromMilliseconds(songCurrentTime).Seconds; - - if (currentSecond != previousSecond || previousTimespan < 0 && songCurrentTime > 0) + if(songCurrentTime < endTime - startTime) { - previousTimespan = songCurrentTime; - previousSecond = currentSecond; + int currentSecond = TimeSpan.FromMilliseconds(songCurrentTime).Seconds; - if(songCurrentTime < 0) - timeCurrent.Text = @"-" + TimeSpan.FromMilliseconds(songCurrentTime - 1000).ToString(@"m\:ss"); - else - timeCurrent.Text = TimeSpan.FromMilliseconds(songCurrentTime).ToString(@"m\:ss"); + if (currentSecond != previousSecond || previousTimespan < 0 && songCurrentTime > 0) + { + previousTimespan = songCurrentTime; + previousSecond = currentSecond; - timeLeft.Text = @"-" + TimeSpan.FromMilliseconds(endTime - AudioClock.CurrentTime).ToString(@"m\:ss"); - } + if (songCurrentTime < 0) + timeCurrent.Text = @"-" + TimeSpan.FromMilliseconds(songCurrentTime - 1000).ToString(@"m\:ss"); + else + timeCurrent.Text = TimeSpan.FromMilliseconds(songCurrentTime).ToString(@"m\:ss"); - int currentPercent = (int)(songCurrentTime / (endTime - startTime) * 100); + timeLeft.Text = @"-" + TimeSpan.FromMilliseconds(endTime - AudioClock.CurrentTime).ToString(@"m\:ss"); + } - if (currentPercent != previousPercent) - { - previousPercent = currentPercent; + int currentPercent = (int)(songCurrentTime / (endTime - startTime) * 100) + 1; - progress.Text = (currentPercent <= 0 ? @"0" : currentPercent.ToString()) + @"%"; + if (currentPercent != previousPercent) + { + previousPercent = currentPercent; + + progress.Text = (currentPercent <= 0 ? @"0" : currentPercent.ToString()) + @"%"; + } } } }