mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Implement quick exit hotkeys for editor test play
This commit is contained in:
parent
e28befb98d
commit
d85c467856
@ -34,6 +34,7 @@ namespace osu.Game.Input.Bindings
|
||||
/// </remarks>
|
||||
public override IEnumerable<IKeyBinding> DefaultKeyBindings => globalKeyBindings
|
||||
.Concat(editorKeyBindings)
|
||||
.Concat(editorTestPlayKeyBindings)
|
||||
.Concat(inGameKeyBindings)
|
||||
.Concat(replayKeyBindings)
|
||||
.Concat(songSelectKeyBindings)
|
||||
@ -68,6 +69,9 @@ namespace osu.Game.Input.Bindings
|
||||
case GlobalActionCategory.Overlays:
|
||||
return overlayKeyBindings;
|
||||
|
||||
case GlobalActionCategory.EditorTestPlay:
|
||||
return editorTestPlayKeyBindings;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException(nameof(category), category, $"Unexpected {nameof(GlobalActionCategory)}");
|
||||
}
|
||||
@ -143,8 +147,14 @@ namespace osu.Game.Input.Bindings
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.MouseWheelLeft }, GlobalAction.EditorCycleNextBeatSnapDivisor),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.R }, GlobalAction.EditorToggleRotateControl),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.E }, GlobalAction.EditorToggleScaleControl),
|
||||
};
|
||||
|
||||
private static IEnumerable<KeyBinding> editorTestPlayKeyBindings => new[]
|
||||
{
|
||||
new KeyBinding(new[] { InputKey.Tab }, GlobalAction.EditorTestPlayToggleAutoplay),
|
||||
new KeyBinding(new[] { InputKey.Control, InputKey.P }, GlobalAction.EditorTestPlayToggleQuickPause),
|
||||
new KeyBinding(new[] { InputKey.F1 }, GlobalAction.EditorTestPlayQuickExitToInitialTime),
|
||||
new KeyBinding(new[] { InputKey.F2 }, GlobalAction.EditorTestPlayQuickExitToCurrentTime),
|
||||
};
|
||||
|
||||
private static IEnumerable<KeyBinding> inGameKeyBindings => new[]
|
||||
@ -440,6 +450,12 @@ namespace osu.Game.Input.Bindings
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayToggleQuickPause))]
|
||||
EditorTestPlayToggleQuickPause,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayQuickExitToInitialTime))]
|
||||
EditorTestPlayQuickExitToInitialTime,
|
||||
|
||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayQuickExitToCurrentTime))]
|
||||
EditorTestPlayQuickExitToCurrentTime,
|
||||
}
|
||||
|
||||
public enum GlobalActionCategory
|
||||
@ -450,6 +466,7 @@ namespace osu.Game.Input.Bindings
|
||||
Replay,
|
||||
SongSelect,
|
||||
AudioControl,
|
||||
Overlays
|
||||
Overlays,
|
||||
EditorTestPlay,
|
||||
}
|
||||
}
|
||||
|
@ -375,14 +375,24 @@ namespace osu.Game.Localisation
|
||||
public static LocalisableString EditorToggleScaleControl => new TranslatableString(getKey(@"editor_toggle_scale_control"), @"Toggle scale control");
|
||||
|
||||
/// <summary>
|
||||
/// "Test play: Toggle autoplay"
|
||||
/// "Toggle autoplay"
|
||||
/// </summary>
|
||||
public static LocalisableString EditorTestPlayToggleAutoplay => new TranslatableString(getKey(@"editor_test_play_toggle_autoplay"), @"Test play: Toggle autoplay");
|
||||
public static LocalisableString EditorTestPlayToggleAutoplay => new TranslatableString(getKey(@"editor_test_play_toggle_autoplay"), @"Toggle autoplay");
|
||||
|
||||
/// <summary>
|
||||
/// "Test play: Toggle quick pause"
|
||||
/// "Toggle quick pause"
|
||||
/// </summary>
|
||||
public static LocalisableString EditorTestPlayToggleQuickPause => new TranslatableString(getKey(@"editor_test_play_toggle_quick_pause"), @"Test play: Toggle quick pause");
|
||||
public static LocalisableString EditorTestPlayToggleQuickPause => new TranslatableString(getKey(@"editor_test_play_toggle_quick_pause"), @"Toggle quick pause");
|
||||
|
||||
/// <summary>
|
||||
/// "Quick exit to initial time"
|
||||
/// </summary>
|
||||
public static LocalisableString EditorTestPlayQuickExitToInitialTime => new TranslatableString(getKey(@"editor_test_play_quick_exit_to_initial_time"), @"Quick exit to initial time");
|
||||
|
||||
/// <summary>
|
||||
/// "Quick exit to current time"
|
||||
/// </summary>
|
||||
public static LocalisableString EditorTestPlayQuickExitToCurrentTime => new TranslatableString(getKey(@"editor_test_play_quick_exit_to_current_time"), @"Quick exit to current time");
|
||||
|
||||
/// <summary>
|
||||
/// "Increase mod speed"
|
||||
|
@ -49,6 +49,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString EditorSection => new TranslatableString(getKey(@"editor_section"), @"Editor");
|
||||
|
||||
/// <summary>
|
||||
/// "Editor: Test play"
|
||||
/// </summary>
|
||||
public static LocalisableString EditorTestPlaySection => new TranslatableString(getKey(@"editor_test_play_section"), @"Editor: Test play");
|
||||
|
||||
/// <summary>
|
||||
/// "Reset all bindings in section"
|
||||
/// </summary>
|
||||
|
@ -31,6 +31,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.InGameSection, GlobalActionCategory.InGame),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.ReplaySection, GlobalActionCategory.Replay),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.EditorSection, GlobalActionCategory.Editor),
|
||||
new GlobalKeyBindingsSubsection(InputSettingsStrings.EditorTestPlaySection, GlobalActionCategory.EditorTestPlay),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -152,6 +152,14 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
||||
toggleQuickPause();
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorTestPlayQuickExitToInitialTime:
|
||||
quickExit(false);
|
||||
return true;
|
||||
|
||||
case GlobalAction.EditorTestPlayQuickExitToCurrentTime:
|
||||
quickExit(true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -190,6 +198,15 @@ namespace osu.Game.Screens.Edit.GameplayTest
|
||||
GameplayClockContainer.Stop();
|
||||
}
|
||||
|
||||
private void quickExit(bool useCurrentTime)
|
||||
{
|
||||
if (useCurrentTime)
|
||||
editorState.Time = GameplayClockContainer.CurrentTime;
|
||||
|
||||
editor.RestoreState(editorState);
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
public override void OnEntering(ScreenTransitionEvent e)
|
||||
{
|
||||
base.OnEntering(e);
|
||||
|
Loading…
Reference in New Issue
Block a user