1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 10:07:36 +08:00

Fix Not update retry counter on PauseOverlay

I've find "You've retried xx time(s)" message that something weird.
That is not displayed pause overlay and only see count on FailOverlay
I change code that PauseContainer.Retries property can be set call-back function.

Signed-off-by: Seokho Song <0xdevssh@gmail.com>
This commit is contained in:
Seokho Song 2017-12-19 00:53:17 +09:00
parent e59ce0cd28
commit 6fbd06f967
2 changed files with 40 additions and 32 deletions

View File

@ -122,44 +122,20 @@ namespace osu.Game.Screens.Play
},
};
Retries = 0;
updateRetryCount();
}
private int retries;
public int Retries
{
set
{
if (retryCounterContainer != null)
{
// "You've retried 1,065 times in this session"
// "You've retried 1 time in this session"
if (value == retries)
return;
retryCounterContainer.Children = new Drawable[]
{
new OsuSpriteText
{
Text = "You've retried ",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $"{value:n0}",
Font = @"Exo2.0-Bold",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $" time{(value == 1 ? "" : "s")} in this session",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
}
};
}
retries = value;
if (retryCounterContainer != null)
updateRetryCount();
}
}
@ -249,6 +225,38 @@ namespace osu.Game.Screens.Play
selectionIndex = InternalButtons.IndexOf(button);
}
private void updateRetryCount()
{
// "You've retried 1,065 times in this session"
// "You've retried 1 time in this session"
retryCounterContainer.Children = new Drawable[]
{
new OsuSpriteText
{
Text = "You've retried ",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $"{retries:n0}",
Font = @"Exo2.0-Bold",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
},
new OsuSpriteText
{
Text = $" time{(retries == 1 ? "" : "s")} in this session",
Shadow = true,
ShadowColour = new Color4(0, 0, 0, 0.25f),
TextSize = 18
}
};
}
private class Button : DialogButton
{
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)

View File

@ -161,8 +161,8 @@ namespace osu.Game.Screens.Play
OnRetry = Restart,
OnQuit = Exit,
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
Retries = RestartCount,
OnPause = () => {
pauseContainer.Retries = RestartCount;
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
},
OnResume = () => {