Add keybind to disable mouse buttons

This commit is contained in:
smoogipoo
2018-05-02 19:37:47 +09:00
parent 420e50b6da
commit d4ada3000c
4 changed files with 16 additions and 2 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Configuration.Tracking;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Screens.Select; using osu.Game.Screens.Select;
@ -95,6 +96,11 @@ namespace osu.Game.Configuration
public OsuConfigManager(Storage storage) : base(storage) public OsuConfigManager(Storage storage) : base(storage)
{ {
} }
public override TrackedSettings CreateTrackedSettings() => new TrackedSettings
{
new TrackedSetting<bool>(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled"))
};
} }
public enum OsuSetting public enum OsuSetting

View File

@ -26,7 +26,8 @@ namespace osu.Game.Input.Bindings
{ {
new KeyBinding(InputKey.F8, GlobalAction.ToggleChat), new KeyBinding(InputKey.F8, GlobalAction.ToggleChat),
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial), new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
new KeyBinding(InputKey.F12,GlobalAction.TakeScreenshot), new KeyBinding(InputKey.F10, GlobalAction.ToggleMouseButtons),
new KeyBinding(InputKey.F12, GlobalAction.TakeScreenshot),
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.R }, GlobalAction.ResetInputSettings), new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.R }, GlobalAction.ResetInputSettings),
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar), new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar),
@ -75,6 +76,8 @@ namespace osu.Game.Input.Bindings
[Description("Quick Retry (Hold)")] [Description("Quick Retry (Hold)")]
QuickRetry, QuickRetry,
[Description("Toggle gameplay mouse buttons")]
ToggleMouseButtons,
[Description("Take screenshot")] [Description("Take screenshot")]
TakeScreenshot TakeScreenshot
} }

View File

@ -466,6 +466,9 @@ namespace osu.Game
case GlobalAction.ToggleDirect: case GlobalAction.ToggleDirect:
direct.ToggleVisibility(); direct.ToggleVisibility();
return true; return true;
case GlobalAction.ToggleMouseButtons:
LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get<bool>(OsuSetting.MouseDisableButtons));
return true;
} }
return false; return false;

View File

@ -14,6 +14,7 @@ using osu.Game.Graphics;
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Game.Configuration;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays namespace osu.Game.Overlays
@ -116,9 +117,10 @@ namespace osu.Game.Overlays
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(FrameworkConfigManager frameworkConfig) private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager osuConfig)
{ {
BeginTracking(this, frameworkConfig); BeginTracking(this, frameworkConfig);
BeginTracking(this, osuConfig);
} }
private readonly Dictionary<(object, IConfigManager), TrackedSettings> trackedConfigManagers = new Dictionary<(object, IConfigManager), TrackedSettings>(); private readonly Dictionary<(object, IConfigManager), TrackedSettings> trackedConfigManagers = new Dictionary<(object, IConfigManager), TrackedSettings>();