1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 03:25:11 +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));
if (whileStopped)
gameplayClockContainer.Stop();
gameplayClockContainer.Reset();
gameplayClockContainer.Reset(startClock: !whileStopped);
});
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)
: 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()

View File

@ -24,7 +24,7 @@ namespace osu.Game.Screens.Play
/// <summary>
/// Whether gameplay is paused.
/// </summary>
public readonly BindableBool IsPaused = new BindableBool();
public readonly BindableBool IsPaused = new BindableBool(true);
/// <summary>
/// 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>
/// Resets this <see cref="GameplayClockContainer"/> and the source to an initial state ready for gameplay.
/// </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>
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.
AdjustableSource.Stop();
if (!IsPaused.Value && startClock)
if (!IsPaused.Value || startClock)
Start();
}