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

Start GameplayClockContainer paused for better state control

This commit is contained in:
Dean Herbert 2022-03-18 15:08:25 +09:00
parent 59aef88504
commit f09a946722
3 changed files with 4 additions and 9 deletions

View File

@ -85,10 +85,7 @@ namespace osu.Game.Tests.Gameplay
Add(gameplayClockContainer = new MasterGameplayClockContainer(working, 0)); Add(gameplayClockContainer = new MasterGameplayClockContainer(working, 0));
if (whileStopped) gameplayClockContainer.Reset(startClock: !whileStopped);
gameplayClockContainer.Stop();
gameplayClockContainer.Reset();
}); });
AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate))); AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate)));

View File

@ -55,8 +55,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
public SpectatorGameplayClockContainer([NotNull] IClock sourceClock) public SpectatorGameplayClockContainer([NotNull] IClock sourceClock)
: base(sourceClock) : base(sourceClock)
{ {
// the container should initially be in a stopped state until the catch-up clock is started by the sync manager.
Stop();
} }
protected override void Update() protected override void Update()

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play
/// <summary> /// <summary>
/// Whether gameplay is paused. /// Whether gameplay is paused.
/// </summary> /// </summary>
public readonly BindableBool IsPaused = new BindableBool(); public readonly BindableBool IsPaused = new BindableBool(true);
/// <summary> /// <summary>
/// The adjustable source clock used for gameplay. Should be used for seeks and clock control. /// The adjustable source clock used for gameplay. Should be used for seeks and clock control.
@ -115,7 +115,7 @@ namespace osu.Game.Screens.Play
/// <summary> /// <summary>
/// Resets this <see cref="GameplayClockContainer"/> and the source to an initial state ready for gameplay. /// Resets this <see cref="GameplayClockContainer"/> and the source to an initial state ready for gameplay.
/// </summary> /// </summary>
/// <param name="startClock">Whether to start the clock immediately.</param> /// <param name="startClock">Whether to start the clock immediately, if not already started.</param>
/// <param name="gameplayStartTime">A time to use for future <see cref="Reset"/> calls as the definite start of gameplay.</param> /// <param name="gameplayStartTime">A time to use for future <see cref="Reset"/> calls as the definite start of gameplay.</param>
public void Reset(bool startClock = false, double? gameplayStartTime = null) public void Reset(bool startClock = false, double? gameplayStartTime = null)
{ {
@ -128,7 +128,7 @@ namespace osu.Game.Screens.Play
// Manually stop the source in order to not affect the IsPaused state. // Manually stop the source in order to not affect the IsPaused state.
AdjustableSource.Stop(); AdjustableSource.Stop();
if (!IsPaused.Value && startClock) if (!IsPaused.Value || startClock)
Start(); Start();
} }