diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fe9345eca8..9240a7c35e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -167,50 +167,5 @@ namespace osu.Game.Screens.Play { Background?.FadeTo((100f - dimLevel) / 100, 800); } - - class PlayerInputManager : UserInputManager - { - public PlayerInputManager(BasicGameHost host) - : base(host) - { - } - - bool leftViaKeyboard; - bool rightViaKeyboard; - Bindable mouseDisabled; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons) - ?? new Bindable(false); - } - - protected override void TransformState(InputState state) - { - base.TransformState(state); - - if (state.Keyboard != null) - { - leftViaKeyboard = state.Keyboard.Keys.Contains(Key.Z); - rightViaKeyboard = state.Keyboard.Keys.Contains(Key.X); - } - - MouseState mouse = (MouseState)state.Mouse; - if (state.Mouse != null) - { - if (mouseDisabled.Value) - { - mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = false; - mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = false; - } - - if (leftViaKeyboard) - mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true; - if (rightViaKeyboard) - mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true; - } - } - } } } \ No newline at end of file diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs new file mode 100644 index 0000000000..b0da57ce0a --- /dev/null +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -0,0 +1,56 @@ +using OpenTK.Input; +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Input; +using osu.Framework.Platform; +using osu.Game.Configuration; +using System; +using System.Linq; + +namespace osu.Game.Screens.Play +{ + class PlayerInputManager : UserInputManager + { + public PlayerInputManager(BasicGameHost host) + : base(host) + { + } + + bool leftViaKeyboard; + bool rightViaKeyboard; + Bindable mouseDisabled; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons) + ?? new Bindable(false); + } + + protected override void TransformState(InputState state) + { + base.TransformState(state); + + if (state.Keyboard != null) + { + leftViaKeyboard = state.Keyboard.Keys.Contains(Key.Z); + rightViaKeyboard = state.Keyboard.Keys.Contains(Key.X); + } + + var mouse = (Framework.Input.MouseState)state.Mouse; + if (state.Mouse != null) + { + if (mouseDisabled.Value) + { + mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = false; + mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = false; + } + + if (leftViaKeyboard) + mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true; + if (rightViaKeyboard) + mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true; + } + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 2261605f50..5f0a29359f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -116,6 +116,7 @@ +