mirror of
https://github.com/ppy/osu.git
synced 2025-03-19 02:07:19 +08:00
Add keybindings for readying and spectating in multi rooms
This commit is contained in:
parent
35c70ceb18
commit
4a8295c49d
@ -36,6 +36,7 @@ namespace osu.Game.Input.Bindings
|
||||
.Concat(editorKeyBindings)
|
||||
.Concat(editorTestPlayKeyBindings)
|
||||
.Concat(inGameKeyBindings)
|
||||
.Concat(multiplayerKeyBindings)
|
||||
.Concat(replayKeyBindings)
|
||||
.Concat(songSelectKeyBindings)
|
||||
.Concat(audioControlKeyBindings)
|
||||
@ -57,6 +58,9 @@ namespace osu.Game.Input.Bindings
|
||||
case GlobalActionCategory.InGame:
|
||||
return inGameKeyBindings;
|
||||
|
||||
case GlobalActionCategory.Multiplayer:
|
||||
return multiplayerKeyBindings;
|
||||
|
||||
case GlobalActionCategory.Replay:
|
||||
return replayKeyBindings;
|
||||
|
||||
@ -186,6 +190,12 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(InputKey.Minus, GlobalAction.DecreaseOffset),
|
||||
};
|
||||
|
||||
private static IEnumerable<KeyBinding> multiplayerKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.R }, GlobalAction.MultiplayerReady),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.S }, GlobalAction.MultiplayerSpectate),
|
||||
};
|
||||
|
||||
private static IEnumerable<KeyBinding> replayKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(InputKey.Space, GlobalAction.TogglePauseReplay),
|
||||
@ -492,6 +502,12 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToNextBookmark))]
|
||||
EditorSeekToNextBookmark,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.MultiplayerReady))]
|
||||
MultiplayerReady,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.MultiplayerSpectate))]
|
||||
MultiplayerSpectate,
|
||||
}
|
||||
|
||||
public enum GlobalActionCategory
|
||||
@ -499,6 +515,7 @@ namespace osu.Game.Input.Bindings
|
||||
General,
|
||||
Editor,
|
||||
InGame,
|
||||
Multiplayer,
|
||||
Replay,
|
||||
SongSelect,
|
||||
AudioControl,
|
||||
|
@ -449,6 +449,16 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString EditorSeekToNextBookmark => new TranslatableString(getKey(@"editor_seek_to_next_bookmark"), @"Seek to next bookmark");
|
||||
|
||||
/// <summary>
|
||||
/// "Ready"
|
||||
/// </summary>
|
||||
public static LocalisableString MultiplayerReady => new TranslatableString(getKey(@"multiplayer_ready"), @"Ready");
|
||||
|
||||
/// <summary>
|
||||
/// "Spectate"
|
||||
/// </summary>
|
||||
public static LocalisableString MultiplayerSpectate => new TranslatableString(getKey(@"multiplayer_spectate"), @"Spectate");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString InGameSection => new TranslatableString(getKey(@"in_game_section"), @"In Game");
|
||||
|
||||
/// <summary>
|
||||
/// "Multiplayer"
|
||||
/// </summary>
|
||||
public static LocalisableString MultiplayerSection => new TranslatableString(getKey(@"multiplayer_section"), @"Multiplayer");
|
||||
|
||||
/// <summary>
|
||||
/// "Replay"
|
||||
/// </summary>
|
||||
|
@ -29,6 +29,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.AudioSection, GlobalActionCategory.AudioControl),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.SongSelectSection, GlobalActionCategory.SongSelect),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.InGameSection, GlobalActionCategory.InGame),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.MultiplayerSection, GlobalActionCategory.Multiplayer),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.ReplaySection, GlobalActionCategory.Replay),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.EditorSection, GlobalActionCategory.Editor),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.EditorTestPlaySection, GlobalActionCategory.EditorTestPlay),
|
||||
|
@ -11,7 +11,10 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Multiplayer.Countdown;
|
||||
using osu.Game.Online.Rooms;
|
||||
@ -21,7 +24,7 @@ using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
{
|
||||
public partial class MatchStartControl : CompositeDrawable
|
||||
public partial class MatchStartControl : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public required Bindable<PlaylistItem?> SelectedItem
|
||||
{
|
||||
@ -251,6 +254,28 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
});
|
||||
}
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (!readyButton.Enabled.Value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.MultiplayerReady:
|
||||
onReadyButtonClick();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||
{
|
||||
}
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
@ -8,18 +8,21 @@ using osu.Framework.Extensions;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.Multiplayer;
|
||||
using osu.Game.Online.Rooms;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
{
|
||||
public partial class MultiplayerSpectateButton : CompositeDrawable
|
||||
public partial class MultiplayerSpectateButton : CompositeDrawable, IKeyBindingHandler<GlobalAction>
|
||||
{
|
||||
public required Bindable<PlaylistItem?> SelectedItem
|
||||
{
|
||||
@ -104,6 +107,28 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Match
|
||||
Scheduler.AddOnce(checkForAutomaticDownload);
|
||||
}
|
||||
|
||||
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||
{
|
||||
if (operationInProgress.Value)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.MultiplayerSpectate:
|
||||
onClick();
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnReleased(KeyBindingReleaseEvent<GlobalAction> e)
|
||||
{
|
||||
}
|
||||
|
||||
#region Automatic download handling
|
||||
|
||||
[Resolved]
|
||||
|
Loading…
x
Reference in New Issue
Block a user