mirror of https://github.com/ppy/osu
Applied suggested changes
This commit is contained in:
parent
7b17e331c4
commit
d8f9e71b84
|
@ -23,7 +23,7 @@ public class SongProgressInfo : Container
|
|||
|
||||
private int previousPercent;
|
||||
private int previousSecond;
|
||||
private bool defaultsSetted;
|
||||
private double previousTimespan;
|
||||
|
||||
private const int margin = 10;
|
||||
|
||||
|
@ -75,25 +75,14 @@ protected override void Update()
|
|||
|
||||
double songCurrentTime = AudioClock.CurrentTime - startTime;
|
||||
|
||||
if (!defaultsSetted)
|
||||
{
|
||||
timeCurrent.Text = @"0:00";
|
||||
timeLeft.Text = TimeSpan.FromMilliseconds(endTime - startTime).ToString(@"m\:ss");
|
||||
progress.Text = @"0%";
|
||||
|
||||
defaultsSetted = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(songCurrentTime >= 0)
|
||||
{
|
||||
int currentSecond = TimeSpan.FromMilliseconds(songCurrentTime).Seconds;
|
||||
|
||||
if (currentSecond != previousSecond)
|
||||
if (currentSecond != previousSecond || (previousTimespan < 0 && songCurrentTime > 0))
|
||||
{
|
||||
previousTimespan = songCurrentTime;
|
||||
previousSecond = currentSecond;
|
||||
|
||||
timeCurrent.Text = TimeSpan.FromMilliseconds(songCurrentTime).ToString(@"m\:ss");
|
||||
timeCurrent.Text = ((songCurrentTime < 0) ? @"-" : @"") + TimeSpan.FromMilliseconds(songCurrentTime).ToString(@"m\:ss");
|
||||
timeLeft.Text = @"-" + TimeSpan.FromMilliseconds(endTime - AudioClock.CurrentTime).ToString(@"m\:ss");
|
||||
}
|
||||
|
||||
|
@ -103,9 +92,7 @@ protected override void Update()
|
|||
{
|
||||
previousPercent = currentPercent;
|
||||
|
||||
progress.Text = currentPercent.ToString() + @"%";
|
||||
}
|
||||
}
|
||||
progress.Text = ((currentPercent <= 0) ? @"0" : currentPercent.ToString()) + @"%";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue