Skip to content

Commit

Permalink
Merge pull request #30878 from peppy/config-pause-hold-thing-of-course
Browse files Browse the repository at this point in the history
Add setting to allow hold-for-pause to still exist
  • Loading branch information
smoogipoo authored Nov 26, 2024
2 parents 2859599 + e3ea38a commit 943837e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions osu.Game/Configuration/OsuConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ protected override void InitialiseDefaults()
SetDefault(OsuSetting.EditorContractSidebars, false);

SetDefault(OsuSetting.AlwaysShowHoldForMenuButton, false);
SetDefault(OsuSetting.AlwaysRequireHoldingForPause, false);
}

protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup)
Expand Down Expand Up @@ -444,5 +445,6 @@ public enum OsuSetting
EditorRotationOrigin,
EditorTimelineShowBreaks,
EditorAdjustExistingObjectsOnTimingChanges,
AlwaysRequireHoldingForPause
}
}
5 changes: 5 additions & 0 deletions osu.Game/Localisation/GameplaySettingsStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public static class GameplaySettingsStrings
/// </summary>
public static LocalisableString AlwaysShowHoldForMenuButton => new TranslatableString(getKey(@"always_show_hold_for_menu_button"), @"Always show hold for menu button");

/// <summary>
/// "Require holding key to pause gameplay"
/// </summary>
public static LocalisableString AlwaysRequireHoldForMenu => new TranslatableString(getKey(@"require_holding_key_to_pause_gameplay"), @"Require holding key to pause gameplay");

/// <summary>
/// "Always play first combo break sound"
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ private void load(OsuConfigManager config)
Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard),
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.AlwaysRequireHoldForMenu,
Current = config.GetBindable<bool>(OsuSetting.AlwaysRequireHoldingForPause),
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.AlwaysShowHoldForMenuButton,
Current = config.GetBindable<bool>(OsuSetting.AlwaysShowHoldForMenuButton),
Expand Down
10 changes: 7 additions & 3 deletions osu.Game/Screens/Play/HUD/HoldForMenuButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,18 @@ private partial class HoldButton : HoldToConfirmContainer, IKeyBindingHandler<Gl
private bool pendingAnimation;
private ScheduledDelegate shakeOperation;

private Bindable<bool> alwaysRequireHold;

public HoldButton(bool isDangerousAction)
: base(isDangerousAction)
{
}

[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OsuColour colours, OsuConfigManager config)
{
alwaysRequireHold = config.GetBindable<bool>(OsuSetting.AlwaysRequireHoldingForPause);

Size = new Vector2(60);

Child = new CircularContainer
Expand Down Expand Up @@ -300,7 +304,7 @@ public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
case GlobalAction.Back:
if (!pendingAnimation)
{
if (IsDangerousAction)
if (IsDangerousAction || alwaysRequireHold.Value)
BeginConfirm();
else
Confirm();
Expand All @@ -314,7 +318,7 @@ public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)

if (!pendingAnimation)
{
if (IsDangerousAction)
if (IsDangerousAction || alwaysRequireHold.Value)
BeginConfirm();
else
Confirm();
Expand Down

0 comments on commit 943837e

Please sign in to comment.