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
1 changed files with 13 additions and 4 deletions

View File

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