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

Fix binding order of IsPaused bindable and disable playback controls in spectator mode.

This commit is contained in:
Nitrous 2024-01-09 22:09:20 +08:00
parent c081ca2145
commit 484e9e8ee6
No known key found for this signature in database
GPG Key ID: A5D82BAEC7C1D1F5
2 changed files with 13 additions and 2 deletions

View File

@ -27,6 +27,8 @@ namespace osu.Game.Screens.Play.PlayerSettings
Precision = 0.1, Precision = 0.1,
}; };
public readonly Bindable<bool> AllowControls = new BindableBool(true);
private readonly PlayerSliderBar<double> rateSlider; private readonly PlayerSliderBar<double> rateSlider;
private readonly OsuSpriteText multiplierText; private readonly OsuSpriteText multiplierText;
@ -71,6 +73,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre, Origin = Anchor.Centre,
Icon = FontAwesome.Solid.FastBackward, Icon = FontAwesome.Solid.FastBackward,
Action = () => seek(-1, seek_fast_amount), Action = () => seek(-1, seek_fast_amount),
Enabled = { BindTarget = AllowControls },
}, },
new SeekButton new SeekButton
{ {
@ -78,6 +81,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre, Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Backward, Icon = FontAwesome.Solid.Backward,
Action = () => seek(-1, seek_amount), Action = () => seek(-1, seek_amount),
Enabled = { BindTarget = AllowControls },
}, },
play = new IconButton play = new IconButton
{ {
@ -95,7 +99,8 @@ namespace osu.Game.Screens.Play.PlayerSettings
else else
gameplayClock.Start(); gameplayClock.Start();
} }
} },
Enabled = { BindTarget = AllowControls },
}, },
new SeekButton new SeekButton
{ {
@ -103,6 +108,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre, Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Forward, Icon = FontAwesome.Solid.Forward,
Action = () => seek(1, seek_amount), Action = () => seek(1, seek_amount),
Enabled = { BindTarget = AllowControls },
}, },
new SeekButton new SeekButton
{ {
@ -110,6 +116,7 @@ namespace osu.Game.Screens.Play.PlayerSettings
Origin = Anchor.Centre, Origin = Anchor.Centre,
Icon = FontAwesome.Solid.FastForward, Icon = FontAwesome.Solid.FastForward,
Action = () => seek(1, seek_fast_amount), Action = () => seek(1, seek_fast_amount),
Enabled = { BindTarget = AllowControls },
}, },
}, },
}, },
@ -150,7 +157,9 @@ namespace osu.Game.Screens.Play.PlayerSettings
{ {
base.LoadComplete(); base.LoadComplete();
rateSlider.Current.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true); rateSlider.Current.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true);
gameplayClock?.IsPaused.BindTo(isPaused);
if (gameplayClock != null)
isPaused.BindTarget = gameplayClock.IsPaused;
} }
private partial class SeekButton : IconButton private partial class SeekButton : IconButton

View File

@ -68,6 +68,8 @@ namespace osu.Game.Screens.Play
master.UserPlaybackRate.Value = 1; master.UserPlaybackRate.Value = 1;
} }
}, true); }, true);
HUDOverlay.PlayerSettingsOverlay.PlaybackSettings.AllowControls.Value = false;
} }
/// <summary> /// <summary>