From 311c2aec1c66bad9b2a652af1a28b6c51785d330 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jul 2017 17:53:36 +0900 Subject: [PATCH 1/5] Fix next track not automatically playing when music controller is not visible --- osu.Game/Overlays/MusicController.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f6190f09af..092082595c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -59,6 +59,9 @@ namespace osu.Game.Overlays { Width = 400; Margin = new MarginPadding(10); + + // required to let MusicController handle beatmap cycling. + AlwaysPresent = true; } protected override bool OnDragStart(InputState state) => true; From 1bd3519ecb97c587ba02fc0aa0ca976f92bf5738 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jul 2017 18:38:27 +0900 Subject: [PATCH 2/5] Have beatmap return a zero-length TrackVirtual instead of null on load failure --- osu.Game/Database/DatabaseWorkingBeatmap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Database/DatabaseWorkingBeatmap.cs b/osu.Game/Database/DatabaseWorkingBeatmap.cs index c56d6cea51..2acae9c340 100644 --- a/osu.Game/Database/DatabaseWorkingBeatmap.cs +++ b/osu.Game/Database/DatabaseWorkingBeatmap.cs @@ -69,7 +69,7 @@ namespace osu.Game.Database var trackData = getReader()?.GetStream(Metadata.AudioFile); return trackData == null ? null : new TrackBass(trackData); } - catch { return null; } + catch { return new TrackVirtual(); } } } -} \ No newline at end of file +} From 773ef26ce339c5f63cac5873066afdd3ad025fda Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jul 2017 18:38:49 +0900 Subject: [PATCH 3/5] Make MusicController support disabled beatmap bindable --- osu.Game/Overlays/MusicController.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 092082595c..baf58ae26c 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -255,12 +255,16 @@ namespace osu.Game.Overlays private void prev() { + if (beatmapBacking.Disabled) return; + queuedDirection = TransformDirection.Prev; playlist.PlayPrevious(); } private void next() { + if (beatmapBacking.Disabled) return; + queuedDirection = TransformDirection.Next; playlist.PlayNext(); } From 9bbcc0526de83b6c6845bd8c984e330b7d51d2b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 11 Jul 2017 18:39:10 +0900 Subject: [PATCH 4/5] Disable beatmap changes in specified screens --- osu.Game/Screens/OsuScreen.cs | 9 +++++++-- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- osu.Game/Screens/Ranking/Results.cs | 2 +- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 4f8109b4e4..f0e673a739 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -29,7 +29,11 @@ namespace osu.Game.Screens internal virtual bool HasLocalCursorDisplayed => false; - internal virtual bool AllowRulesetChange => true; + /// + /// Whether the beatmap or ruleset should be allowed to be changed by the user or game. + /// Used to mark exclusive areas where this is strongly prohibited, like gameplay. + /// + internal virtual bool AllowBeatmapRulesetChange => true; private readonly Bindable beatmap = new Bindable(); @@ -85,7 +89,8 @@ namespace osu.Game.Screens { if (!IsCurrentScreen) return; - ruleset.Disabled = !AllowRulesetChange; + ruleset.Disabled = !AllowBeatmapRulesetChange; + beatmap.Disabled = !AllowBeatmapRulesetChange; } protected override void OnResuming(Screen last) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index d0ffe1de1c..a7ea77c710 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Play public Action RestartRequested; - internal override bool AllowRulesetChange => false; + internal override bool AllowBeatmapRulesetChange => false; public bool HasFailed { get; private set; } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index c8ebb1f436..f2ed378e7c 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play private bool showOverlays = true; internal override bool ShowOverlays => showOverlays; - internal override bool AllowRulesetChange => false; + internal override bool AllowBeatmapRulesetChange => false; protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap); diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index dac83536ed..636851e14d 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -31,7 +31,7 @@ namespace osu.Game.Screens.Ranking private ResultModeTabControl modeChangeButtons; - internal override bool AllowRulesetChange => false; + internal override bool AllowBeatmapRulesetChange => false; private Container currentPage; From 04e99d1369ca6bf51ae6e982d8ab3e6f1e6ed764 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 12 Jul 2017 13:40:17 +0900 Subject: [PATCH 5/5] Only apply disable rules when in a screen stack. --- osu.Game/Screens/OsuScreen.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index f0e673a739..64223db100 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -89,8 +89,13 @@ namespace osu.Game.Screens { if (!IsCurrentScreen) return; - ruleset.Disabled = !AllowBeatmapRulesetChange; - beatmap.Disabled = !AllowBeatmapRulesetChange; + if (ParentScreen != null) + { + // we only want to apply these restrictions when we are inside a screen stack. + // the use case for not applying is in visual/unit tests. + ruleset.Disabled = !AllowBeatmapRulesetChange; + beatmap.Disabled = !AllowBeatmapRulesetChange; + } } protected override void OnResuming(Screen last)