From ad2df8d8dfdfc775098ae07725adaa03a00f47b0 Mon Sep 17 00:00:00 2001 From: Michael Manis Date: Sun, 21 Jan 2018 20:09:44 -0500 Subject: [PATCH 1/5] Fixed tilde-key crash at end of beatmap. --- osu.Game/Screens/Play/Player.cs | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8d26d63d41..d50f463c2c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -88,6 +88,9 @@ namespace osu.Game.Screens.Play private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true; + private bool allowRestart = true; + private bool exited = false; + [BackgroundDependencyLoader] private void load(AudioManager audio, OsuConfigManager config, APIAccess api) { @@ -208,10 +211,12 @@ namespace osu.Game.Screens.Play new HotkeyRetryOverlay { Action = () => { - //we want to hide the hitrenderer immediately (looks better). - //we may be able to remove this once the mouse cursor trail is improved. - RulesetContainer?.Hide(); - Restart(); + if (allowRestart) { + //we want to hide the hitrenderer immediately (looks better). + //we may be able to remove this once the mouse cursor trail is improved. + RulesetContainer?.Hide(); + Restart(); + } }, } }; @@ -266,6 +271,7 @@ namespace osu.Game.Screens.Play public void Restart() { + exited = true; sampleRestart?.Play(); ValidForResume = false; RestartRequested?.Invoke(); @@ -288,6 +294,11 @@ namespace osu.Game.Screens.Play { onCompletionEvent = Schedule(delegate { + // This is here to mimic OsuStable behavior. It could be placed outside the delay timer, + // which would remove the need for the check on Push() below, and would make it impossible + // to quick-restart after hitting the last note. + allowRestart = false; + var score = new Score { Beatmap = Beatmap.Value.BeatmapInfo, @@ -295,7 +306,7 @@ namespace osu.Game.Screens.Play }; scoreProcessor.PopulateScore(score); score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; - Push(new Results(score)); + if (!exited) Push(new Results(score)); }); } } From 806da2176051fa3748a3617a1e1fdf862a54e881 Mon Sep 17 00:00:00 2001 From: Michael Manis Date: Sun, 21 Jan 2018 20:24:19 -0500 Subject: [PATCH 2/5] Removed rreduntant initialization. --- osu.Game/Screens/Play/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d50f463c2c..2885427e88 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Play private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true; private bool allowRestart = true; - private bool exited = false; + private bool exited; [BackgroundDependencyLoader] private void load(AudioManager audio, OsuConfigManager config, APIAccess api) From 964c6da9a436319f69c7f67fc62a2bdfa0da2413 Mon Sep 17 00:00:00 2001 From: Michael Manis Date: Sun, 21 Jan 2018 22:00:18 -0500 Subject: [PATCH 3/5] Use IsCurrentScreen instead of a bool --- osu.Game/Screens/Play/Player.cs | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2885427e88..4f7f145ed0 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -89,7 +89,6 @@ namespace osu.Game.Screens.Play private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true; private bool allowRestart = true; - private bool exited; [BackgroundDependencyLoader] private void load(AudioManager audio, OsuConfigManager config, APIAccess api) @@ -271,7 +270,6 @@ namespace osu.Game.Screens.Play public void Restart() { - exited = true; sampleRestart?.Play(); ValidForResume = false; RestartRequested?.Invoke(); @@ -294,19 +292,19 @@ namespace osu.Game.Screens.Play { onCompletionEvent = Schedule(delegate { - // This is here to mimic OsuStable behavior. It could be placed outside the delay timer, - // which would remove the need for the check on Push() below, and would make it impossible - // to quick-restart after hitting the last note. - allowRestart = false; - - var score = new Score + if (IsCurrentScreen) { - Beatmap = Beatmap.Value.BeatmapInfo, - Ruleset = ruleset - }; - scoreProcessor.PopulateScore(score); - score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; - if (!exited) Push(new Results(score)); + allowRestart = false; + + var score = new Score + { + Beatmap = Beatmap.Value.BeatmapInfo, + Ruleset = ruleset + }; + scoreProcessor.PopulateScore(score); + score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; + Push(new Results(score)); + } }); } } From 530e0afa2c89acda8dc9cc26100501ebd015ba51 Mon Sep 17 00:00:00 2001 From: Michael Manis Date: Sun, 21 Jan 2018 22:27:15 -0500 Subject: [PATCH 4/5] Use IsCurrentScreen instead of a bool for both checks now. --- osu.Game/Screens/Play/Player.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 4f7f145ed0..e29ff8edd3 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -88,8 +88,6 @@ namespace osu.Game.Screens.Play private bool loadedSuccessfully => RulesetContainer?.Objects.Any() == true; - private bool allowRestart = true; - [BackgroundDependencyLoader] private void load(AudioManager audio, OsuConfigManager config, APIAccess api) { @@ -210,7 +208,7 @@ namespace osu.Game.Screens.Play new HotkeyRetryOverlay { Action = () => { - if (allowRestart) { + if (IsCurrentScreen) { //we want to hide the hitrenderer immediately (looks better). //we may be able to remove this once the mouse cursor trail is improved. RulesetContainer?.Hide(); @@ -294,8 +292,6 @@ namespace osu.Game.Screens.Play { if (IsCurrentScreen) { - allowRestart = false; - var score = new Score { Beatmap = Beatmap.Value.BeatmapInfo, From 794ae5380a341b83feb61377f9710369211bfe0d Mon Sep 17 00:00:00 2001 From: Michael Manis Date: Mon, 22 Jan 2018 01:06:27 -0500 Subject: [PATCH 5/5] Intverted conditionals. --- osu-framework | 2 +- osu.Game/Screens/Play/Player.cs | 31 +++++++++++++++---------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/osu-framework b/osu-framework index 26c01ca606..8f36ddab94 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 26c01ca6069296621f76d8ffbfe31ecf8074c687 +Subproject commit 8f36ddab946ff538620081ede7719461d4732b79 diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e29ff8edd3..a53d598730 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -208,12 +208,12 @@ namespace osu.Game.Screens.Play new HotkeyRetryOverlay { Action = () => { - if (IsCurrentScreen) { - //we want to hide the hitrenderer immediately (looks better). - //we may be able to remove this once the mouse cursor trail is improved. - RulesetContainer?.Hide(); - Restart(); - } + if (!IsCurrentScreen) return; + + //we want to hide the hitrenderer immediately (looks better). + //we may be able to remove this once the mouse cursor trail is improved. + RulesetContainer?.Hide(); + Restart(); }, } }; @@ -290,17 +290,16 @@ namespace osu.Game.Screens.Play { onCompletionEvent = Schedule(delegate { - if (IsCurrentScreen) + if (!IsCurrentScreen) return; + + var score = new Score { - var score = new Score - { - Beatmap = Beatmap.Value.BeatmapInfo, - Ruleset = ruleset - }; - scoreProcessor.PopulateScore(score); - score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; - Push(new Results(score)); - } + Beatmap = Beatmap.Value.BeatmapInfo, + Ruleset = ruleset + }; + scoreProcessor.PopulateScore(score); + score.User = RulesetContainer.Replay?.User ?? api.LocalUser.Value; + Push(new Results(score)); }); } }