mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +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()
|
||||
{
|
||||
// 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();
|
||||
else
|
||||
GameplayClockContainer.Stop();
|
||||
|
@ -23,11 +23,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
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>
|
||||
/// Invoked when a seek has been performed via <see cref="Seek"/>
|
||||
/// </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>
|
||||
public GameplayClockContainer(IClock sourceClock, bool applyOffsets = false)
|
||||
{
|
||||
SourceClock = sourceClock;
|
||||
|
||||
RelativeSizeAxes = Axes.Both;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
@ -71,6 +64,8 @@ namespace osu.Game.Screens.Play
|
||||
GameplayClock = new FramedBeatmapClock(applyOffsets, requireDecoupling: true),
|
||||
Content
|
||||
};
|
||||
|
||||
GameplayClock.ChangeSource(sourceClock);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -83,8 +78,6 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
isPaused.Value = false;
|
||||
|
||||
ensureSourceClockSet();
|
||||
|
||||
PrepareStart();
|
||||
|
||||
// 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();
|
||||
|
||||
ensureSourceClockSet();
|
||||
|
||||
if (time != null)
|
||||
StartTime = time.Value;
|
||||
|
||||
@ -168,21 +159,7 @@ namespace osu.Game.Screens.Play
|
||||
/// Changes the source clock.
|
||||
/// </summary>
|
||||
/// <param name="sourceClock">The new source.</param>
|
||||
protected void ChangeSource(IClock sourceClock) => GameplayClock.ChangeSource(SourceClock = 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);
|
||||
}
|
||||
protected void ChangeSource(IClock sourceClock) => GameplayClock.ChangeSource(sourceClock);
|
||||
|
||||
#region IAdjustableClock
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user