From 9a040691238ab2d377128efe00a72200e178a279 Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Fri, 12 May 2017 10:16:31 +0300 Subject: [PATCH] removed useless booleans, using nullables instead --- osu.Game/Screens/Play/SongProgressInfo.cs | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/SongProgressInfo.cs b/osu.Game/Screens/Play/SongProgressInfo.cs index 36bb344dab..4c53b61313 100644 --- a/osu.Game/Screens/Play/SongProgressInfo.cs +++ b/osu.Game/Screens/Play/SongProgressInfo.cs @@ -21,14 +21,11 @@ namespace osu.Game.Screens.Play private double startTime; private double endTime; - private int previousPercent; - private int previousSecond; + private int? previousPercent; + private int? previousSecond; private double songLength => endTime - startTime; - private bool percentHasChanged = true; - private bool secondHasChanged = true; - private const int margin = 10; public IClock AudioClock; @@ -81,22 +78,19 @@ namespace osu.Game.Screens.Play int currentPercent = Math.Max(0, Math.Min(100, (int)(songCurrentTime / songLength * 100))); int currentSecond = (int)Math.Floor(songCurrentTime / 1000.0); - if (percentHasChanged) + if (currentPercent != previousPercent) { progress.Text = currentPercent.ToString() + @"%"; previousPercent = currentPercent; } - if (secondHasChanged && songCurrentTime < songLength) + if (currentSecond != previousSecond && songCurrentTime < songLength) { timeCurrent.Text = TimeSpan.FromSeconds(currentSecond).ToString(songCurrentTime < 0 ? @"\-m\:ss" : @"m\:ss"); timeLeft.Text = TimeSpan.FromMilliseconds(endTime - AudioClock.CurrentTime).ToString(@"\-m\:ss"); previousSecond = currentSecond; } - - percentHasChanged = currentPercent != previousPercent; - secondHasChanged = currentSecond != previousSecond; } } }