mirror of
https://github.com/osukey/osukey.git
synced 2025-05-25 15:37:24 +09:00
Expose and set GameplayStartTime
directly, rather than via Reset
parameter
This commit is contained in:
parent
9c68b3edc5
commit
d4286255a0
@ -197,7 +197,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
.DefaultIfEmpty(0)
|
.DefaultIfEmpty(0)
|
||||||
.Min();
|
.Min();
|
||||||
|
|
||||||
masterClockContainer.Reset(true, startTime);
|
masterClockContainer.StartTime = startTime;
|
||||||
|
masterClockContainer.Reset(true);
|
||||||
|
|
||||||
// Although the clock has been started, this flag is set to allow for later synchronisation state changes to also be able to start it.
|
// Although the clock has been started, this flag is set to allow for later synchronisation state changes to also be able to start it.
|
||||||
canStartMasterClock = true;
|
canStartMasterClock = true;
|
||||||
|
@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// If not set, a value of zero will be used.
|
/// 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.
|
/// Importantly, the value will be inferred from the current ruleset in <see cref="MasterGameplayClockContainer"/> unless specified.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
protected double? StartTime { get; set; }
|
public double? StartTime { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="GameplayClockContainer"/>.
|
/// Creates a new <see cref="GameplayClockContainer"/>.
|
||||||
@ -116,12 +116,8 @@ namespace osu.Game.Screens.Play
|
|||||||
/// Resets this <see cref="GameplayClockContainer"/> and the source to an initial state ready for gameplay.
|
/// Resets this <see cref="GameplayClockContainer"/> and the source to an initial state ready for gameplay.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="startClock">Whether to start the clock immediately, if not already started.</param>
|
/// <param name="startClock">Whether to start the clock immediately, if not already started.</param>
|
||||||
/// <param name="gameplayStartTime">A time to use for future <see cref="Reset"/> calls as the definite start of gameplay.</param>
|
public void Reset(bool startClock = false)
|
||||||
public void Reset(bool startClock = false, double? gameplayStartTime = null)
|
|
||||||
{
|
{
|
||||||
if (gameplayStartTime != null)
|
|
||||||
StartTime = gameplayStartTime;
|
|
||||||
|
|
||||||
// Manually stop the source in order to not affect the IsPaused state.
|
// Manually stop the source in order to not affect the IsPaused state.
|
||||||
AdjustableSource.Stop();
|
AdjustableSource.Stop();
|
||||||
|
|
||||||
|
@ -100,9 +100,9 @@ namespace osu.Game.Screens.Play
|
|||||||
bool isStarted = !IsPaused.Value;
|
bool isStarted = !IsPaused.Value;
|
||||||
|
|
||||||
// If a custom start time was not specified, calculate the best value to use.
|
// If a custom start time was not specified, calculate the best value to use.
|
||||||
double gameplayStartTime = StartTime ?? findEarliestStartTime();
|
StartTime ??= findEarliestStartTime();
|
||||||
|
|
||||||
Reset(startClock: isStarted, gameplayStartTime: gameplayStartTime);
|
Reset(startClock: isStarted);
|
||||||
}
|
}
|
||||||
|
|
||||||
private double findEarliestStartTime()
|
private double findEarliestStartTime()
|
||||||
|
@ -621,7 +621,8 @@ namespace osu.Game.Screens.Play
|
|||||||
bool wasFrameStable = DrawableRuleset.FrameStablePlayback;
|
bool wasFrameStable = DrawableRuleset.FrameStablePlayback;
|
||||||
DrawableRuleset.FrameStablePlayback = false;
|
DrawableRuleset.FrameStablePlayback = false;
|
||||||
|
|
||||||
GameplayClockContainer.Reset(gameplayStartTime: time);
|
GameplayClockContainer.StartTime = time;
|
||||||
|
GameplayClockContainer.Reset();
|
||||||
|
|
||||||
// Delay resetting frame-stable playback for one frame to give the FrameStabilityContainer a chance to seek.
|
// Delay resetting frame-stable playback for one frame to give the FrameStabilityContainer a chance to seek.
|
||||||
frameStablePlaybackResetDelegate = ScheduleAfterChildren(() => DrawableRuleset.FrameStablePlayback = wasFrameStable);
|
frameStablePlaybackResetDelegate = ScheduleAfterChildren(() => DrawableRuleset.FrameStablePlayback = wasFrameStable);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user