1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-14 05:47:20 +08:00

Expose StartTime from gameplay clock

This commit is contained in:
Salman Ahmed 2022-07-29 16:12:52 +03:00
parent e664690fe2
commit 3f72e76348
2 changed files with 24 additions and 1 deletions

View File

@ -35,6 +35,15 @@ namespace osu.Game.Screens.Play
UnderlyingClock = underlyingClock;
}
/// <summary>
/// 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.
/// </remarks>
public double? StartTime { get; internal set; }
public double CurrentTime => UnderlyingClock.CurrentTime;
public double Rate => UnderlyingClock.Rate;

View File

@ -44,6 +44,8 @@ namespace osu.Game.Screens.Play
/// </summary>
public event Action OnSeek;
private double? startTime;
/// <summary>
/// The time from which the clock should start. Will be seeked to on calling <see cref="Reset"/>.
/// </summary>
@ -51,7 +53,17 @@ namespace osu.Game.Screens.Play
/// 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.
/// </remarks>
public double? StartTime { get; set; }
public double? StartTime
{
get => startTime;
set
{
startTime = value;
if (GameplayClock != null)
GameplayClock.StartTime = value;
}
}
/// <summary>
/// Creates a new <see cref="GameplayClockContainer"/>.
@ -72,6 +84,8 @@ namespace osu.Game.Screens.Play
var dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
dependencies.CacheAs(GameplayClock = CreateGameplayClock(AdjustableSource));
GameplayClock.StartTime = StartTime;
GameplayClock.IsPaused.BindTo(IsPaused);
return dependencies;