1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-21 03:02:54 +08:00

Fix pause triggered when already paused

This commit is contained in:
smoogipoo 2019-05-10 15:51:12 +09:00
parent 7c105fd99f
commit 6a957ad27f
3 changed files with 14 additions and 3 deletions

View File

@ -25,6 +25,8 @@ namespace osu.Game.Screens.Play.HUD
{
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
private readonly Button button;
public Action Action
@ -51,7 +53,8 @@ namespace osu.Game.Screens.Play.HUD
button = new Button
{
HoverGained = () => text.FadeIn(500, Easing.OutQuint),
HoverLost = () => text.FadeOut(500, Easing.OutQuint)
HoverLost = () => text.FadeOut(500, Easing.OutQuint),
IsPaused = { BindTarget = IsPaused }
}
};
AutoSizeAxes = Axes.Both;
@ -94,6 +97,8 @@ namespace osu.Game.Screens.Play.HUD
private CircularProgress circularProgress;
private Circle overlayCircle;
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
protected override bool AllowMultipleFires => true;
public Action HoverGained;
@ -217,7 +222,7 @@ namespace osu.Game.Screens.Play.HUD
private void updateActive()
{
if (!pauseOnFocusLost) return;
if (!pauseOnFocusLost || IsPaused.Value) return;
if (gameActive.Value)
AbortConfirm();

View File

@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play
public readonly HoldForMenuButton HoldToQuit;
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
public readonly IBindable<bool> IsPaused = new Bindable<bool>();
private Bindable<bool> showHud;
private readonly Container visibilityContainer;
private readonly BindableBool replayLoaded = new BindableBool();

View File

@ -137,7 +137,11 @@ namespace osu.Game.Screens.Play
DrawableRuleset.Cursor?.CreateProxy() ?? new Container(),
HUDOverlay = new HUDOverlay(ScoreProcessor, DrawableRuleset, Mods.Value)
{
HoldToQuit = { Action = performUserRequestedExit },
HoldToQuit =
{
Action = performUserRequestedExit,
IsPaused = { BindTarget = GameplayClockContainer.IsPaused }
},
PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } },
KeyCounter = { Visible = { BindTarget = DrawableRuleset.HasReplayLoaded } },
RequestSeek = GameplayClockContainer.Seek,