Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix retry count not displaying on pause overlay #1709

Merged
merged 3 commits into from Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
71 changes: 40 additions & 31 deletions osu.Game/Screens/Play/GameplayMenuOverlay.cs
Expand Up @@ -124,44 +124,21 @@ private void load(OsuColour colours)
},
};

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();
}
}

Expand Down Expand Up @@ -252,6 +229,38 @@ private void buttonSelectionChanged(DialogButton button, bool isSelected)
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)
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Screens/Play/Player.cs
Expand Up @@ -161,8 +161,8 @@ private void load(AudioManager audio, OsuConfigManager config, APIAccess api)
OnRetry = Restart,
OnQuit = Exit,
CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded,
Retries = RestartCount,
OnPause = () => {
pauseContainer.Retries = RestartCount;
hudOverlay.KeyCounter.IsCounting = pauseContainer.IsPaused;
},
OnResume = () => {
Expand Down