From f48d497737a324fb187680592485e4b5031c3326 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 18:56:20 +0900 Subject: [PATCH 1/2] Fix disabling mouse buttons causing auto to stop working. --- .../OsuKeyConversionInputManager.cs | 16 ---------- osu.Game/Screens/Play/PlayerInputManager.cs | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+), 16 deletions(-) diff --git a/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs b/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs index e71f15cd65..d60aab90fb 100644 --- a/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuKeyConversionInputManager.cs @@ -2,10 +2,7 @@ // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Input; -using osu.Game.Configuration; using osu.Game.Screens.Play; using OpenTK.Input; using KeyboardState = osu.Framework.Input.KeyboardState; @@ -17,13 +14,6 @@ namespace osu.Game.Rulesets.Osu { private bool leftViaKeyboard; private bool rightViaKeyboard; - private Bindable mouseDisabled; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons); - } protected override void TransformState(InputState state) { @@ -40,12 +30,6 @@ namespace osu.Game.Rulesets.Osu if (mouse != null) { - if (mouseDisabled.Value) - { - mouse.SetPressed(MouseButton.Left, false); - mouse.SetPressed(MouseButton.Right, false); - } - if (leftViaKeyboard) mouse.SetPressed(MouseButton.Left, true); if (rightViaKeyboard) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 3ac28898a6..180c15e30b 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -1,8 +1,12 @@ // Copyright (c) 2007-2017 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +using OpenTK.Input; +using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Input; using osu.Framework.Timing; +using osu.Game.Configuration; using osu.Game.Input.Handlers; namespace osu.Game.Screens.Play @@ -28,6 +32,14 @@ namespace osu.Game.Screens.Play } } + private Bindable mouseDisabled; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + mouseDisabled = config.GetBindable(OsuConfig.MouseDisableButtons); + } + protected override void LoadComplete() { base.LoadComplete(); @@ -66,5 +78,24 @@ namespace osu.Game.Screens.Play base.Update(); } } + + protected override void TransformState(InputState state) + { + base.TransformState(state); + + // we don't want to transform the state if a replay is present (for now, at least). + if (replayInputHandler != null) return; + + var mouse = state.Mouse as Framework.Input.MouseState; + + if (mouse != null) + { + if (mouseDisabled.Value) + { + mouse.SetPressed(MouseButton.Left, false); + mouse.SetPressed(MouseButton.Right, false); + } + } + } } } From e826f17eb03c2b301704616b286760c1c11e3e87 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Apr 2017 19:25:41 +0900 Subject: [PATCH 2/2] Fix get-set mismatch. --- osu.Game/Screens/Play/PlayerInputManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerInputManager.cs b/osu.Game/Screens/Play/PlayerInputManager.cs index 180c15e30b..a31cf6e288 100644 --- a/osu.Game/Screens/Play/PlayerInputManager.cs +++ b/osu.Game/Screens/Play/PlayerInputManager.cs @@ -19,7 +19,10 @@ namespace osu.Game.Screens.Play private ReplayInputHandler replayInputHandler; public ReplayInputHandler ReplayInputHandler { - get { return replayInputHandler; } + get + { + return replayInputHandler; + } set { if (replayInputHandler != null) RemoveHandler(replayInputHandler);