1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 14:12:54 +08:00

Added PauseOverlay.SetRetries for updating the retry indicator

This commit is contained in:
DrabWeb 2017-01-28 20:56:23 -04:00
parent d4216eb539
commit d0a22bfdd4

View File

@ -68,7 +68,6 @@ namespace osu.Game.Overlays.Pause
}, },
retryCounter = new SpriteText retryCounter = new SpriteText
{ {
Text = @"You've retried 0 times in this session",
Origin = Anchor.TopCentre, Origin = Anchor.TopCentre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Width = 100, Width = 100,
@ -108,7 +107,7 @@ namespace osu.Game.Overlays.Pause
Action = (delegate Action = (delegate
{ {
Hide(); Hide();
Task.Delay(fadeDuration * 2).ContinueWith(t=> OnResume?.Invoke()); Task.Delay(fadeDuration * 2).ContinueWith(task => OnResume?.Invoke());
}), }),
}, },
new PauseButton new PauseButton
@ -135,7 +134,17 @@ namespace osu.Game.Overlays.Pause
}, },
} }
}, },
}; };
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() protected override void PopIn()
@ -155,7 +164,7 @@ namespace osu.Game.Overlays.Pause
case Key.Escape: case Key.Escape:
if (State == Visibility.Hidden) return false; if (State == Visibility.Hidden) return false;
Hide(); Hide();
Task.Delay(fadeDuration * 2).ContinueWith(t => OnResume?.Invoke()); Task.Delay(fadeDuration * 2).ContinueWith(task => OnResume?.Invoke());
return true; return true;
} }
return base.OnKeyDown(state, args); return base.OnKeyDown(state, args);