1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Stop progress as soon as we at 100%

This commit is contained in:
EVAST9919 2017-05-11 01:48:46 +03:00
parent 5b469eff69
commit d55c97a08a
2 changed files with 24 additions and 18 deletions

View File

@ -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);
}
}
}
}

View File

@ -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()) + @"%";
}
}
}
}