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.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(Key[] keys) => new KeyCombination(keys);
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
{
ToggleChat,
ToggleSocial
ToggleSocial,
ResetInputSettings,
ToggleToolbar,
ToggleSettings,
ToggleDirect
}
}

View File

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