mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 05:42:56 +08:00
Fix souce clock not always being transferred to FramedBeatmapClock
in time
This commit is contained in:
parent
59d6e67512
commit
586311d508
@ -49,7 +49,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
protected override void Update()
|
protected override void Update()
|
||||||
{
|
{
|
||||||
// The player clock's running state is controlled externally, but the local pausing state needs to be updated to start/stop gameplay.
|
// The player clock's running state is controlled externally, but the local pausing state needs to be updated to start/stop gameplay.
|
||||||
if (GameplayClockContainer.SourceClock.IsRunning)
|
if (GameplayClockContainer.IsRunning)
|
||||||
GameplayClockContainer.Start();
|
GameplayClockContainer.Start();
|
||||||
else
|
else
|
||||||
GameplayClockContainer.Stop();
|
GameplayClockContainer.Stop();
|
||||||
|
@ -23,11 +23,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public bool IsRewinding => GameplayClock.IsRewinding;
|
public bool IsRewinding => GameplayClock.IsRewinding;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// The source clock. Should generally not be used for any timekeeping purposes.
|
|
||||||
/// </summary>
|
|
||||||
public IClock SourceClock { get; private set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Invoked when a seek has been performed via <see cref="Seek"/>
|
/// Invoked when a seek has been performed via <see cref="Seek"/>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -62,8 +57,6 @@ namespace osu.Game.Screens.Play
|
|||||||
/// <param name="applyOffsets">Whether to apply platform, user and beatmap offsets to the mix.</param>
|
/// <param name="applyOffsets">Whether to apply platform, user and beatmap offsets to the mix.</param>
|
||||||
public GameplayClockContainer(IClock sourceClock, bool applyOffsets = false)
|
public GameplayClockContainer(IClock sourceClock, bool applyOffsets = false)
|
||||||
{
|
{
|
||||||
SourceClock = sourceClock;
|
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
@ -71,6 +64,8 @@ namespace osu.Game.Screens.Play
|
|||||||
GameplayClock = new FramedBeatmapClock(applyOffsets, requireDecoupling: true),
|
GameplayClock = new FramedBeatmapClock(applyOffsets, requireDecoupling: true),
|
||||||
Content
|
Content
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GameplayClock.ChangeSource(sourceClock);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -83,8 +78,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
isPaused.Value = false;
|
isPaused.Value = false;
|
||||||
|
|
||||||
ensureSourceClockSet();
|
|
||||||
|
|
||||||
PrepareStart();
|
PrepareStart();
|
||||||
|
|
||||||
// The case which caused this to be added is FrameStabilityContainer, which manages its own current and elapsed time.
|
// The case which caused this to be added is FrameStabilityContainer, which manages its own current and elapsed time.
|
||||||
@ -153,8 +146,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Stop();
|
Stop();
|
||||||
|
|
||||||
ensureSourceClockSet();
|
|
||||||
|
|
||||||
if (time != null)
|
if (time != null)
|
||||||
StartTime = time.Value;
|
StartTime = time.Value;
|
||||||
|
|
||||||
@ -168,21 +159,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// Changes the source clock.
|
/// Changes the source clock.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sourceClock">The new source.</param>
|
/// <param name="sourceClock">The new source.</param>
|
||||||
protected void ChangeSource(IClock sourceClock) => GameplayClock.ChangeSource(SourceClock = sourceClock);
|
protected void ChangeSource(IClock sourceClock) => GameplayClock.ChangeSource(sourceClock);
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Ensures that the <see cref="GameplayClock"/> is set to <see cref="SourceClock"/>, if it hasn't been given a source yet.
|
|
||||||
/// This is usually done before a seek to avoid accidentally seeking only the adjustable source in decoupled mode,
|
|
||||||
/// but not the actual source clock.
|
|
||||||
/// That will pretty much only happen on the very first call of this method, as the source clock is passed in the constructor,
|
|
||||||
/// but it is not yet set on the adjustable source there.
|
|
||||||
/// </summary>
|
|
||||||
private void ensureSourceClockSet()
|
|
||||||
{
|
|
||||||
// TODO: does this need to exist?
|
|
||||||
if (GameplayClock.Source != SourceClock)
|
|
||||||
ChangeSource(SourceClock);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region IAdjustableClock
|
#region IAdjustableClock
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user