mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 11:22:57 +08:00
Merge pull request #1869 from Aergwyn/ingame-keybinds
Add skip cutscene as "in game" keybinding
This commit is contained in:
commit
e7f9c9f22b
@ -20,7 +20,9 @@ namespace osu.Game.Input.Bindings
|
||||
handler = game;
|
||||
}
|
||||
|
||||
public override IEnumerable<KeyBinding> DefaultKeyBindings => new[]
|
||||
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings);
|
||||
|
||||
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(InputKey.F8, GlobalAction.ToggleChat),
|
||||
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
|
||||
@ -33,6 +35,11 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.MouseWheelDown }, GlobalAction.DecreaseVolume),
|
||||
};
|
||||
|
||||
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene)
|
||||
};
|
||||
|
||||
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
|
||||
handler == null ? base.KeyBindingInputQueue : new[] { handler }.Concat(base.KeyBindingInputQueue);
|
||||
}
|
||||
@ -55,5 +62,9 @@ namespace osu.Game.Input.Bindings
|
||||
IncreaseVolume,
|
||||
[Description("Decrease Volume")]
|
||||
DecreaseVolume,
|
||||
|
||||
// In-Game Keybindings
|
||||
[Description("Skip Cutscene")]
|
||||
SkipCutscene
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays.Settings;
|
||||
|
||||
namespace osu.Game.Overlays.KeyBinding
|
||||
@ -12,19 +12,31 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_hot;
|
||||
public override string Header => "Global";
|
||||
|
||||
public GlobalKeyBindingsSection(KeyBindingContainer manager)
|
||||
public GlobalKeyBindingsSection(GlobalKeyBindingInputManager manager)
|
||||
{
|
||||
Add(new DefaultBindingsSubsection(manager));
|
||||
Add(new InGameKeyBindingsSubsection(manager));
|
||||
}
|
||||
|
||||
|
||||
private class DefaultBindingsSubsection : KeyBindingsSubsection
|
||||
{
|
||||
protected override string Header => string.Empty;
|
||||
|
||||
public DefaultBindingsSubsection(KeyBindingContainer manager)
|
||||
public DefaultBindingsSubsection(GlobalKeyBindingInputManager manager)
|
||||
: base(null)
|
||||
{
|
||||
Defaults = manager.DefaultKeyBindings;
|
||||
Defaults = manager.GlobalKeyBindings;
|
||||
}
|
||||
}
|
||||
|
||||
private class InGameKeyBindingsSubsection : KeyBindingsSubsection
|
||||
{
|
||||
protected override string Header => "In Game";
|
||||
|
||||
public InGameKeyBindingsSubsection(GlobalKeyBindingInputManager manager) : base(null)
|
||||
{
|
||||
Defaults = manager.InGameKeyBindings;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14,13 +14,14 @@ using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Screens.Ranking;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Game.Input.Bindings;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class SkipButton : Container
|
||||
public class SkipButton : Container, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
private readonly double startTime;
|
||||
public IAdjustableClock AudioClock;
|
||||
@ -117,20 +118,20 @@ namespace osu.Game.Screens.Play
|
||||
remainingTimeBox.ResizeWidthTo((float)Math.Max(0, 1 - (Time.Current - displayTime) / (beginFadeTime - displayTime)), 120, Easing.OutQuint);
|
||||
}
|
||||
|
||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
if (args.Repeat) return false;
|
||||
|
||||
switch (args.Key)
|
||||
switch (action)
|
||||
{
|
||||
case Key.Space:
|
||||
case GlobalAction.SkipCutscene:
|
||||
button.TriggerOnClick();
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action) => false;
|
||||
|
||||
private class FadeContainer : Container, IStateful<Visibility>
|
||||
{
|
||||
public event Action<Visibility> StateChanged;
|
||||
|
Loading…
Reference in New Issue
Block a user