Move all OsuGame events to OsuAction

This commit is contained in:
Dean Herbert
2017-08-10 16:45:10 +09:00
parent 30bd1d70b5
commit d9e36237c7
4 changed files with 21 additions and 26 deletions

View File

@ -12,6 +12,10 @@ namespace osu.Game.Input
{ {
{ Key.F8, OsuAction.ToggleChat }, { Key.F8, OsuAction.ToggleChat },
{ Key.F9, OsuAction.ToggleSocial }, { Key.F9, OsuAction.ToggleSocial },
{ new[] { Key.LControl, Key.LAlt, Key.R }, OsuAction.ResetInputSettings },
{ new[] { Key.LControl, Key.T }, OsuAction.ToggleToolbar },
{ new[] { Key.LControl, Key.O }, OsuAction.ToggleSettings },
{ new[] { Key.LControl, Key.D }, OsuAction.ToggleDirect },
}; };
} }
} }

View File

@ -53,6 +53,8 @@ namespace osu.Game.Input
public static implicit operator KeyCombination(string stringRepresentation) => new KeyCombination(stringRepresentation); public static implicit operator KeyCombination(string stringRepresentation) => new KeyCombination(stringRepresentation);
public static implicit operator KeyCombination(Key[] keys) => new KeyCombination(keys);
public override string ToString() => Keys.Select(k => ((int)k).ToString()).Aggregate((s1, s2) => $"{s1},{s2}"); public override string ToString() => Keys.Select(k => ((int)k).ToString()).Aggregate((s1, s2) => $"{s1},{s2}");
} }
} }

View File

@ -6,6 +6,10 @@ namespace osu.Game.Input
public enum OsuAction public enum OsuAction
{ {
ToggleChat, ToggleChat,
ToggleSocial ToggleSocial,
ResetInputSettings,
ToggleToolbar,
ToggleSettings,
ToggleDirect
} }
} }

View File

@ -9,7 +9,6 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Framework.Input; using osu.Framework.Input;
using OpenTK.Input;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Game.Graphics.UserInterface.Volume; using osu.Game.Graphics.UserInterface.Volume;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -266,16 +265,7 @@ namespace osu.Game
case OsuAction.ToggleSocial: case OsuAction.ToggleSocial:
social.ToggleVisibility(); social.ToggleVisibility();
return true; return true;
} case OsuAction.ResetInputSettings:
}
if (state.Keyboard.ControlPressed)
{
switch (args.Key)
{
case Key.R:
if (state.Keyboard.AltPressed)
{
var sensitivity = frameworkConfig.GetBindable<double>(FrameworkSetting.CursorSensitivity); var sensitivity = frameworkConfig.GetBindable<double>(FrameworkSetting.CursorSensitivity);
sensitivity.Disabled = false; sensitivity.Disabled = false;
@ -284,18 +274,13 @@ namespace osu.Game
frameworkConfig.Set(FrameworkSetting.ActiveInputHandlers, string.Empty); frameworkConfig.Set(FrameworkSetting.ActiveInputHandlers, string.Empty);
return true; return true;
} case OsuAction.ToggleToolbar:
break;
case Key.T:
Toolbar.ToggleVisibility(); Toolbar.ToggleVisibility();
return true; return true;
case Key.O: case OsuAction.ToggleSettings:
settings.ToggleVisibility(); settings.ToggleVisibility();
return true; return true;
case Key.D: case OsuAction.ToggleDirect:
if (state.Keyboard.ShiftPressed || state.Keyboard.AltPressed)
return false;
direct.ToggleVisibility(); direct.ToggleVisibility();
return true; return true;
} }