mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Change GameplayClockContainer.Reset
to directly call GameplayClock.Stop
The reasoning is explained in the inline comment, but basically this was getting blocked by `isPaused` being in an initial `true` state (as it is on construction), while the source clock was still `IsRunning`. There's no real guarantee of sync between the source and the `isPaused` bindable right now. Maybe there should be in the future, but to restore sanity, let's ensure that a call to `Reset` can at least stop the track as we expect.
This commit is contained in:
parent
100c0cf533
commit
f0bd975393
@ -138,12 +138,15 @@ namespace osu.Game.Screens.Play
|
||||
/// Resets this <see cref="GameplayClockContainer"/> and the source to an initial state ready for gameplay.
|
||||
/// </summary>
|
||||
/// <param name="time">The time to seek to on resetting. If <c>null</c>, the existing <see cref="StartTime"/> will be used.</param>
|
||||
/// <param name="startClock">Whether to start the clock immediately, if not already started.</param>
|
||||
/// <param name="startClock">Whether to start the clock immediately. If <c>false</c>, the clock will remain stopped after this call.</param>
|
||||
public void Reset(double? time = null, bool startClock = false)
|
||||
{
|
||||
bool wasPaused = isPaused.Value;
|
||||
|
||||
Stop();
|
||||
// The intention of the Reset method is to get things into a known sane state.
|
||||
// As such, we intentionally stop the underlying clock directly here, bypassing Stop/StopGameplayClock.
|
||||
// This is to avoid any kind of isPaused state checks and frequency ramping (as provided by MasterGameplayClockContainer).
|
||||
GameplayClock.Stop();
|
||||
|
||||
if (time != null)
|
||||
StartTime = time.Value;
|
||||
|
Loading…
Reference in New Issue
Block a user