From 9013afe41243aaee9e13e6646661e3821fc50d02 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 19:35:40 +0900 Subject: [PATCH] Query for input manager once --- osu.Game/Screens/Play/PlayerLoader.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 92ff57b799..da51e25b4e 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -44,6 +45,8 @@ namespace osu.Game.Screens.Play private Task loadTask; + private InputManager inputManager; + public PlayerLoader(Func createPlayer) { this.createPlayer = createPlayer; @@ -203,6 +206,12 @@ namespace osu.Game.Screens.Play } } + protected override void LoadComplete() + { + inputManager = GetContainingInputManager(); + base.LoadComplete(); + } + private void cancelLoad() { pushDebounce?.Cancel(); @@ -244,7 +253,7 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; - if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) + if (inputManager.HoveredDrawables.Contains(VisualSettings)) { // Acts as an "on hover" trigger for the visual settings panel. // Preview user-defined background dim and blur when hovered on the visual settings panel.