From 09dd0cabd64b6084aa0d40e64e119993c6844289 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Aug 2017 15:58:47 +0900 Subject: [PATCH] Move beatmap/ruleset change restrictions to OsuGame Allows test cases to more freely exist --- osu.Game/OsuGame.cs | 7 +++++++ osu.Game/Screens/OsuScreen.cs | 13 ------------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e3525e423c..68b5aa1cc9 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -359,6 +359,13 @@ namespace osu.Game { base.UpdateAfterChildren(); + // 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. + bool applyRestrictions = currentScreen?.AllowBeatmapRulesetChange ?? false; + + Ruleset.Disabled = applyRestrictions; + Beatmap.Disabled = applyRestrictions; + mainContent.Padding = new MarginPadding { Top = ToolbarOffset }; Cursor.State = currentScreen?.HasLocalCursorDisplayed == false ? Visibility.Visible : Visibility.Hidden; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 6e79d2b427..ae10d8828b 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -69,19 +69,6 @@ namespace osu.Game.Screens sampleExit = audio.Sample.Get(@"UI/melodic-1"); } - protected override void Update() - { - if (!IsCurrentScreen) return; - - 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) { base.OnResuming(last);