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

Query for input manager once

This commit is contained in:
David Zhao 2019-03-20 19:35:40 +09:00
parent b5e8eb2a4a
commit 9013afe412

View File

@ -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<Player> 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.