1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 08:22:56 +08:00

Merge branch 'master' into undelete-button-add

This commit is contained in:
Dean Herbert 2017-12-21 22:32:08 +09:00
commit a9039c71e0
2 changed files with 41 additions and 32 deletions

View File

@ -124,44 +124,21 @@ namespace osu.Game.Screens.Play
}, },
}; };
Retries = 0; updateRetryCount();
} }
private int retries;
public int Retries public int Retries
{ {
set set
{ {
if (retryCounterContainer != null) if (value == retries)
{ return;
// "You've retried 1,065 times in this session"
// "You've retried 1 time in this session"
retryCounterContainer.Children = new Drawable[] retries = value;
{ if (retryCounterContainer != null)
new OsuSpriteText updateRetryCount();
{
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
}
};
}
} }
} }
@ -252,6 +229,38 @@ namespace osu.Game.Screens.Play
selectionIndex = InternalButtons.IndexOf(button); 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 private class Button : DialogButton
{ {
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)

View File

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