From d0a22bfdd41313910d8171bd01661bbe0ee04b6b Mon Sep 17 00:00:00 2001 From: DrabWeb Date: Sat, 28 Jan 2017 20:56:23 -0400 Subject: [PATCH] Added PauseOverlay.SetRetries for updating the retry indicator --- osu.Game/Overlays/Pause/PauseOverlay.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Pause/PauseOverlay.cs b/osu.Game/Overlays/Pause/PauseOverlay.cs index 93c3d8509d..f7cf7861ad 100644 --- a/osu.Game/Overlays/Pause/PauseOverlay.cs +++ b/osu.Game/Overlays/Pause/PauseOverlay.cs @@ -68,7 +68,6 @@ private void load(OsuColour colours) }, retryCounter = new SpriteText { - Text = @"You've retried 0 times in this session", Origin = Anchor.TopCentre, Anchor = Anchor.Centre, Width = 100, @@ -108,7 +107,7 @@ private void load(OsuColour colours) Action = (delegate { Hide(); - Task.Delay(fadeDuration * 2).ContinueWith(t=> OnResume?.Invoke()); + Task.Delay(fadeDuration * 2).ContinueWith(task => OnResume?.Invoke()); }), }, new PauseButton @@ -135,7 +134,17 @@ private void load(OsuColour colours) }, } }, - }; + }; + + SetRetries(0); + } + + public void SetRetries(int count) + { + if (retryCounter != null) + // "You've retried 1,065 times in this session" + // "You've retried 1 time in this session" + retryCounter.Text = $"You've retried {String.Format("{0:n0}", count)} time{(count == 1) ? "" : "s"} in this session"; } protected override void PopIn() @@ -155,7 +164,7 @@ protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) case Key.Escape: if (State == Visibility.Hidden) return false; Hide(); - Task.Delay(fadeDuration * 2).ContinueWith(t => OnResume?.Invoke()); + Task.Delay(fadeDuration * 2).ContinueWith(task => OnResume?.Invoke()); return true; } return base.OnKeyDown(state, args);