Implement quick pause toggle for editor test play

This commit is contained in:
Bartłomiej Dach 2024-07-02 14:00:18 +02:00
parent 1e4db77925
commit e28befb98d
No known key found for this signature in database
3 changed files with 22 additions and 1 deletions

View File

@ -100,7 +100,6 @@ namespace osu.Game.Input.Bindings
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.F }, GlobalAction.ToggleFPSDisplay),
new KeyBinding(new[] { InputKey.Control, InputKey.T }, GlobalAction.ToggleToolbar),
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.S }, GlobalAction.ToggleSkinEditor),
new KeyBinding(new[] { InputKey.Control, InputKey.P }, GlobalAction.ToggleProfile),
new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.R }, GlobalAction.ResetInputSettings),
@ -118,6 +117,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(new[] { InputKey.Control, InputKey.B }, GlobalAction.ToggleBeatmapListing),
new KeyBinding(new[] { InputKey.Control, InputKey.O }, GlobalAction.ToggleSettings),
new KeyBinding(new[] { InputKey.Control, InputKey.N }, GlobalAction.ToggleNotifications),
new KeyBinding(new[] { InputKey.Control, InputKey.P }, GlobalAction.ToggleProfile),
};
private static IEnumerable<KeyBinding> editorKeyBindings => new[]
@ -144,6 +144,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(new[] { InputKey.Control, InputKey.R }, GlobalAction.EditorToggleRotateControl),
new KeyBinding(new[] { InputKey.Control, InputKey.E }, GlobalAction.EditorToggleScaleControl),
new KeyBinding(new[] { InputKey.Tab }, GlobalAction.EditorTestPlayToggleAutoplay),
new KeyBinding(new[] { InputKey.Control, InputKey.P }, GlobalAction.EditorTestPlayToggleQuickPause),
};
private static IEnumerable<KeyBinding> inGameKeyBindings => new[]
@ -436,6 +437,9 @@ namespace osu.Game.Input.Bindings
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayToggleAutoplay))]
EditorTestPlayToggleAutoplay,
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayToggleQuickPause))]
EditorTestPlayToggleQuickPause,
}
public enum GlobalActionCategory

View File

@ -379,6 +379,11 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString EditorTestPlayToggleAutoplay => new TranslatableString(getKey(@"editor_test_play_toggle_autoplay"), @"Test play: Toggle autoplay");
/// <summary>
/// "Test play: Toggle quick pause"
/// </summary>
public static LocalisableString EditorTestPlayToggleQuickPause => new TranslatableString(getKey(@"editor_test_play_toggle_quick_pause"), @"Test play: Toggle quick pause");
/// <summary>
/// "Increase mod speed"
/// </summary>

View File

@ -148,6 +148,10 @@ namespace osu.Game.Screens.Edit.GameplayTest
toggleAutoplay();
return true;
case GlobalAction.EditorTestPlayToggleQuickPause:
toggleQuickPause();
return true;
default:
return false;
}
@ -178,6 +182,14 @@ namespace osu.Game.Screens.Edit.GameplayTest
DrawableRuleset.SetReplayScore(null);
}
private void toggleQuickPause()
{
if (GameplayClockContainer.IsPaused.Value)
GameplayClockContainer.Start();
else
GameplayClockContainer.Stop();
}
public override void OnEntering(ScreenTransitionEvent e)
{
base.OnEntering(e);