Ensure setting a StartTime on a GameplayClockContainer always resets to the new time

This commit is contained in:
Dean Herbert 2022-08-18 18:28:55 +09:00
parent 2c6fd1ec6e
commit 43879633db
2 changed files with 15 additions and 1 deletions

View File

@ -90,6 +90,9 @@ namespace osu.Game.Tests.Gameplay
AddUntilStep("sample has lifetime end", () => sample.LifetimeEnd < double.MaxValue);
}
/// <summary>
/// Sample at 0ms, start time at 1000ms (so the sample should not be played).
/// </summary>
[Test]
public void TestSampleHasLifetimeEndWithInitialClockTime()
{

View File

@ -38,12 +38,23 @@ namespace osu.Game.Screens.Play
/// <summary>
/// The time from which the clock should start. Will be seeked to on calling <see cref="Reset"/>.
/// Settting a start time will <see cref="Reset"/> to the new value.
/// </summary>
/// <remarks>
/// 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; } = 0;
public double StartTime
{
get => startTime;
set
{
startTime = value;
Reset();
}
}
private double startTime;
public virtual IEnumerable<double> NonGameplayAdjustments => Enumerable.Empty<double>();