mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 11:03:05 +08:00
Fix `GameplayClockContainer potentially resetting external seeks
This commit is contained in:
parent
728cd96508
commit
2c6fd1ec6e
@ -281,7 +281,7 @@ namespace osu.Game.Rulesets.UI
|
||||
}
|
||||
}
|
||||
|
||||
public double? StartTime => parentGameplayClock?.StartTime;
|
||||
public double StartTime => parentGameplayClock?.StartTime ?? 0;
|
||||
|
||||
public IEnumerable<double> NonGameplayAdjustments => parentGameplayClock?.NonGameplayAdjustments ?? Enumerable.Empty<double>();
|
||||
|
||||
|
@ -40,10 +40,10 @@ namespace osu.Game.Screens.Play
|
||||
/// The time from which the clock should start. Will be seeked to on calling <see cref="Reset"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If not set, a value of zero will be used.
|
||||
/// Importantly, the value will be inferred from the current ruleset in <see cref="MasterGameplayClockContainer"/> unless specified.
|
||||
/// By default, a value of zero will be used.
|
||||
/// Importantly, the value will be inferred from the current beatmap in <see cref="MasterGameplayClockContainer"/> by default.
|
||||
/// </remarks>
|
||||
public double? StartTime { get; set; }
|
||||
public double StartTime { get; set; } = 0;
|
||||
|
||||
public virtual IEnumerable<double> NonGameplayAdjustments => Enumerable.Empty<double>();
|
||||
|
||||
@ -130,7 +130,7 @@ namespace osu.Game.Screens.Play
|
||||
Start();
|
||||
|
||||
ensureSourceClockSet();
|
||||
Seek(StartTime ?? 0);
|
||||
Seek(StartTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
if (isInIntro)
|
||||
{
|
||||
double introStartTime = GameplayClock.StartTime ?? 0;
|
||||
double introStartTime = GameplayClock.StartTime;
|
||||
|
||||
double introOffsetCurrent = currentTime - introStartTime;
|
||||
double introDuration = FirstHitTime - introStartTime;
|
||||
|
@ -19,10 +19,10 @@ namespace osu.Game.Screens.Play
|
||||
/// The time from which the clock should start. Will be seeked to on calling <see cref="GameplayClockContainer.Reset"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If not set, a value of zero will be used.
|
||||
/// Importantly, the value will be inferred from the current ruleset in <see cref="MasterGameplayClockContainer"/> unless specified.
|
||||
/// By default, a value of zero will be used.
|
||||
/// Importantly, the value will be inferred from the current beatmap in <see cref="MasterGameplayClockContainer"/> by default.
|
||||
/// </remarks>
|
||||
double? StartTime { get; }
|
||||
double StartTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// All adjustments applied to this clock which don't come from gameplay or mods.
|
||||
|
@ -57,20 +57,8 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
this.beatmap = beatmap;
|
||||
this.skipTargetTime = skipTargetTime;
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
// Reset may have been called externally before LoadComplete.
|
||||
// If it was, and the clock is in a playing state, we want to ensure that it isn't stopped here.
|
||||
bool isStarted = !IsPaused.Value;
|
||||
|
||||
// If a custom start time was not specified, calculate the best value to use.
|
||||
StartTime ??= findEarliestStartTime();
|
||||
|
||||
Reset(startClock: isStarted);
|
||||
StartTime = findEarliestStartTime();
|
||||
}
|
||||
|
||||
private double findEarliestStartTime()
|
||||
|
Loading…
Reference in New Issue
Block a user