1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 19:04:06 +08:00

Make replays pause with middle mouse button instead of exiting

This commit is contained in:
Joseph Madamba 2023-01-01 18:00:39 -08:00
parent 83b8d8ad8c
commit d79ee29f29
3 changed files with 21 additions and 2 deletions

View File

@ -31,6 +31,8 @@ namespace osu.Game.Screens.Play.HUD
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
public readonly Bindable<bool> ReplayLoaded = new Bindable<bool>();
private HoldButton button;
public Action Action { get; set; }
@ -60,6 +62,7 @@ namespace osu.Game.Screens.Play.HUD
HoverGained = () => text.FadeIn(500, Easing.OutQuint),
HoverLost = () => text.FadeOut(500, Easing.OutQuint),
IsPaused = { BindTarget = IsPaused },
ReplayLoaded = { BindTarget = ReplayLoaded },
Action = () => Action(),
}
};
@ -110,6 +113,8 @@ namespace osu.Game.Screens.Play.HUD
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
public readonly Bindable<bool> ReplayLoaded = new Bindable<bool>();
protected override bool AllowMultipleFires => true;
public Action HoverGained;
@ -251,7 +256,14 @@ namespace osu.Game.Screens.Play.HUD
switch (e.Action)
{
case GlobalAction.Back:
case GlobalAction.PauseGameplay: // in the future this behaviour will differ for replays etc.
if (!pendingAnimation)
BeginConfirm();
return true;
case GlobalAction.PauseGameplay:
// handled by replay player
if (ReplayLoaded.Value) return false;
if (!pendingAnimation)
BeginConfirm();
return true;
@ -265,7 +277,12 @@ namespace osu.Game.Screens.Play.HUD
switch (e.Action)
{
case GlobalAction.Back:
AbortConfirm();
break;
case GlobalAction.PauseGameplay:
if (ReplayLoaded.Value) return;
AbortConfirm();
break;
}

View File

@ -433,7 +433,8 @@ namespace osu.Game.Screens.Play
HoldToQuit =
{
Action = () => PerformExit(true),
IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
IsPaused = { BindTarget = GameplayClockContainer.IsPaused },
ReplayLoaded = { BindTarget = DrawableRuleset.HasReplayLoaded },
},
KeyCounter =
{

View File

@ -81,6 +81,7 @@ namespace osu.Game.Screens.Play
return true;
case GlobalAction.TogglePauseReplay:
case GlobalAction.PauseGameplay:
if (GameplayClockContainer.IsPaused.Value)
GameplayClockContainer.Start();
else