mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
add skip cutscene as "in game" keybinding
This commit is contained in:
parent
805e91c625
commit
f6c168be27
@ -20,7 +20,9 @@ namespace osu.Game.Input.Bindings
|
|||||||
handler = game;
|
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.F8, GlobalAction.ToggleChat),
|
||||||
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
|
new KeyBinding(InputKey.F9, GlobalAction.ToggleSocial),
|
||||||
@ -33,6 +35,11 @@ namespace osu.Game.Input.Bindings
|
|||||||
new KeyBinding(new[] { InputKey.MouseWheelDown }, GlobalAction.DecreaseVolume),
|
new KeyBinding(new[] { InputKey.MouseWheelDown }, GlobalAction.DecreaseVolume),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
public IEnumerable<KeyBinding> InGameKeyBindings => new[]
|
||||||
|
{
|
||||||
|
new KeyBinding(InputKey.Space, GlobalAction.SkipCutscene)
|
||||||
|
};
|
||||||
|
|
||||||
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
|
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
|
||||||
handler == null ? base.KeyBindingInputQueue : new[] { handler }.Concat(base.KeyBindingInputQueue);
|
handler == null ? base.KeyBindingInputQueue : new[] { handler }.Concat(base.KeyBindingInputQueue);
|
||||||
}
|
}
|
||||||
@ -55,5 +62,9 @@ namespace osu.Game.Input.Bindings
|
|||||||
IncreaseVolume,
|
IncreaseVolume,
|
||||||
[Description("Decrease Volume")]
|
[Description("Decrease Volume")]
|
||||||
DecreaseVolume,
|
DecreaseVolume,
|
||||||
|
|
||||||
|
// In-Game Keybindings
|
||||||
|
[Description("Skip Cutscene")]
|
||||||
|
SkipCutscene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// 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.Input.Bindings;
|
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.Overlays.Settings;
|
using osu.Game.Overlays.Settings;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.KeyBinding
|
namespace osu.Game.Overlays.KeyBinding
|
||||||
@ -12,19 +12,31 @@ namespace osu.Game.Overlays.KeyBinding
|
|||||||
public override FontAwesome Icon => FontAwesome.fa_osu_hot;
|
public override FontAwesome Icon => FontAwesome.fa_osu_hot;
|
||||||
public override string Header => "Global";
|
public override string Header => "Global";
|
||||||
|
|
||||||
public GlobalKeyBindingsSection(KeyBindingContainer manager)
|
public GlobalKeyBindingsSection(GlobalKeyBindingInputManager manager)
|
||||||
{
|
{
|
||||||
Add(new DefaultBindingsSubsection(manager));
|
Add(new DefaultBindingsSubsection(manager));
|
||||||
|
Add(new InGameKeyBindingsSubsection(manager));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class DefaultBindingsSubsection : KeyBindingsSubsection
|
private class DefaultBindingsSubsection : KeyBindingsSubsection
|
||||||
{
|
{
|
||||||
protected override string Header => string.Empty;
|
protected override string Header => string.Empty;
|
||||||
|
|
||||||
public DefaultBindingsSubsection(KeyBindingContainer manager)
|
public DefaultBindingsSubsection(GlobalKeyBindingInputManager manager)
|
||||||
: base(null)
|
: 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 osu.Game.Screens.Ranking;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Framework.Input.Bindings;
|
||||||
|
using osu.Game.Input.Bindings;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class SkipButton : Container
|
public class SkipButton : Container, IKeyBindingHandler<GlobalAction>
|
||||||
{
|
{
|
||||||
private readonly double startTime;
|
private readonly double startTime;
|
||||||
public IAdjustableClock AudioClock;
|
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);
|
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 (action)
|
||||||
|
|
||||||
switch (args.Key)
|
|
||||||
{
|
{
|
||||||
case Key.Space:
|
case GlobalAction.SkipCutscene:
|
||||||
button.TriggerOnClick();
|
button.TriggerOnClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnKeyDown(state, args);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool OnReleased(GlobalAction action) => false;
|
||||||
|
|
||||||
private class FadeContainer : Container, IStateful<Visibility>
|
private class FadeContainer : Container, IStateful<Visibility>
|
||||||
{
|
{
|
||||||
public event Action<Visibility> StateChanged;
|
public event Action<Visibility> StateChanged;
|
||||||
|
Loading…
Reference in New Issue
Block a user