mirror of
https://github.com/ppy/osu.git
synced 2024-12-16 00:52:59 +08:00
Merge branch 'master' into mobile-ffmpeg
This commit is contained in:
commit
6d18f151fd
@ -20,7 +20,7 @@ namespace osu.Game.Input.Bindings
|
||||
handler = game;
|
||||
}
|
||||
|
||||
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings);
|
||||
public override IEnumerable<KeyBinding> DefaultKeyBindings => GlobalKeyBindings.Concat(InGameKeyBindings).Concat(AudioControlKeyBindings);
|
||||
|
||||
public IEnumerable<KeyBinding> GlobalKeyBindings => new[]
|
||||
{
|
||||
@ -32,11 +32,6 @@ namespace osu.Game.Input.Bindings
|
||||
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.O }, GlobalAction.ToggleSettings),
|
||||
new KeyBinding(InputKey.Up, GlobalAction.IncreaseVolume),
|
||||
new KeyBinding(InputKey.MouseWheelUp, GlobalAction.IncreaseVolume),
|
||||
new KeyBinding(InputKey.Down, GlobalAction.DecreaseVolume),
|
||||
new KeyBinding(InputKey.MouseWheelDown, GlobalAction.DecreaseVolume),
|
||||
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
|
||||
|
||||
new KeyBinding(InputKey.Escape, GlobalAction.Back),
|
||||
new KeyBinding(InputKey.ExtraMouseButton1, GlobalAction.Back),
|
||||
@ -55,6 +50,22 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Minus }, GlobalAction.DecreaseScrollSpeed),
|
||||
};
|
||||
|
||||
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(InputKey.Up, GlobalAction.IncreaseVolume),
|
||||
new KeyBinding(InputKey.MouseWheelUp, GlobalAction.IncreaseVolume),
|
||||
new KeyBinding(InputKey.Down, GlobalAction.DecreaseVolume),
|
||||
new KeyBinding(InputKey.MouseWheelDown, GlobalAction.DecreaseVolume),
|
||||
new KeyBinding(InputKey.F4, GlobalAction.ToggleMute),
|
||||
|
||||
new KeyBinding(InputKey.TrackPrevious, GlobalAction.MusicPrev),
|
||||
new KeyBinding(InputKey.F1, GlobalAction.MusicPrev),
|
||||
new KeyBinding(InputKey.TrackNext, GlobalAction.MusicNext),
|
||||
new KeyBinding(InputKey.F5, GlobalAction.MusicNext),
|
||||
new KeyBinding(InputKey.PlayPause, GlobalAction.MusicPlay),
|
||||
new KeyBinding(InputKey.F3, GlobalAction.MusicPlay)
|
||||
};
|
||||
|
||||
protected override IEnumerable<Drawable> KeyBindingInputQueue =>
|
||||
handler == null ? base.KeyBindingInputQueue : base.KeyBindingInputQueue.Prepend(handler);
|
||||
}
|
||||
@ -115,5 +126,15 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[Description("Quick exit (Hold)")]
|
||||
QuickExit,
|
||||
|
||||
// Game-wide beatmap msi ccotolle keybindings
|
||||
[Description("Next track")]
|
||||
MusicNext,
|
||||
|
||||
[Description("Previous track")]
|
||||
MusicPrev,
|
||||
|
||||
[Description("Play / pause")]
|
||||
MusicPlay,
|
||||
}
|
||||
}
|
||||
|
@ -299,7 +299,7 @@ namespace osu.Game
|
||||
}, $"watch {databasedScoreInfo}", bypassScreenAllowChecks: true);
|
||||
}
|
||||
|
||||
#region Beatmap jukebox progression
|
||||
#region Beatmap progression
|
||||
|
||||
private void beatmapChanged(ValueChangedEvent<WorkingBeatmap> beatmap)
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
public GlobalKeyBindingsSection(GlobalActionContainer manager)
|
||||
{
|
||||
Add(new DefaultBindingsSubsection(manager));
|
||||
Add(new AudioControlKeyBindingsSubsection(manager));
|
||||
Add(new InGameKeyBindingsSubsection(manager));
|
||||
}
|
||||
|
||||
@ -39,5 +40,16 @@ namespace osu.Game.Overlays.KeyBinding
|
||||
Defaults = manager.InGameKeyBindings;
|
||||
}
|
||||
}
|
||||
|
||||
private class AudioControlKeyBindingsSubsection : KeyBindingsSubsection
|
||||
{
|
||||
protected override string Header => "Audio";
|
||||
|
||||
public AudioControlKeyBindingsSubsection(GlobalActionContainer manager)
|
||||
: base(null)
|
||||
{
|
||||
Defaults = manager.AudioControlKeyBindings;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,11 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Overlays.OSD;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
@ -16,7 +19,7 @@ namespace osu.Game.Overlays
|
||||
/// <summary>
|
||||
/// Handles playback of the global music track.
|
||||
/// </summary>
|
||||
public class MusicController : Component
|
||||
public class MusicController : Component, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
@ -37,6 +40,9 @@ namespace osu.Game.Overlays
|
||||
[Resolved]
|
||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private OnScreenDisplay onScreenDisplay { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -222,6 +228,41 @@ namespace osu.Game.Overlays
|
||||
beatmaps.ItemRemoved -= handleBeatmapRemoved;
|
||||
}
|
||||
}
|
||||
|
||||
public bool OnPressed(GlobalAction action)
|
||||
{
|
||||
switch (action)
|
||||
{
|
||||
case GlobalAction.MusicPlay:
|
||||
if (TogglePause())
|
||||
onScreenDisplay?.Display(new MusicControllerToast(IsPlaying ? "Play track" : "Pause track"));
|
||||
return true;
|
||||
|
||||
case GlobalAction.MusicNext:
|
||||
if (NextTrack())
|
||||
onScreenDisplay?.Display(new MusicControllerToast("Next track"));
|
||||
|
||||
return true;
|
||||
|
||||
case GlobalAction.MusicPrev:
|
||||
if (PrevTrack())
|
||||
onScreenDisplay?.Display(new MusicControllerToast("Previous track"));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool OnReleased(GlobalAction action) => false;
|
||||
|
||||
public class MusicControllerToast : Toast
|
||||
{
|
||||
public MusicControllerToast(string action)
|
||||
: base("Music Playback", action, string.Empty)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum TrackChangeDirection
|
||||
|
Loading…
Reference in New Issue
Block a user