mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 15:03:13 +08:00
Fix multiple calls to seek method potentially not working
This commit is contained in:
parent
c3280083a2
commit
be03a2d7d2
@ -583,6 +583,8 @@ namespace osu.Game.Screens.Play
|
||||
/// <param name="time">The destination time to seek to.</param>
|
||||
public void Seek(double time) => GameplayClockContainer.Seek(time);
|
||||
|
||||
private ScheduledDelegate frameStablePlaybackResetDelegate;
|
||||
|
||||
/// <summary>
|
||||
/// Seeks to a specific time in gameplay, bypassing frame stability.
|
||||
/// </summary>
|
||||
@ -592,13 +594,16 @@ namespace osu.Game.Screens.Play
|
||||
/// <param name="time">The destination time to seek to.</param>
|
||||
public void NonFrameStableSeek(double time)
|
||||
{
|
||||
if (frameStablePlaybackResetDelegate?.Cancelled == false && !frameStablePlaybackResetDelegate.Completed)
|
||||
frameStablePlaybackResetDelegate.RunTask();
|
||||
|
||||
bool wasFrameStable = DrawableRuleset.FrameStablePlayback;
|
||||
DrawableRuleset.FrameStablePlayback = false;
|
||||
|
||||
Seek(time);
|
||||
|
||||
// Delay resetting frame-stable playback for one frame to give the FrameStabilityContainer a chance to seek.
|
||||
ScheduleAfterChildren(() => DrawableRuleset.FrameStablePlayback = wasFrameStable);
|
||||
frameStablePlaybackResetDelegate = ScheduleAfterChildren(() => DrawableRuleset.FrameStablePlayback = wasFrameStable);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -931,11 +936,10 @@ namespace osu.Game.Screens.Play
|
||||
/// Creates the player's <see cref="Scoring.Score"/>.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="Scoring.Score"/>.</returns>
|
||||
protected virtual Score CreateScore() =>
|
||||
new Score
|
||||
{
|
||||
ScoreInfo = new ScoreInfo { User = api.LocalUser.Value },
|
||||
};
|
||||
protected virtual Score CreateScore() => new Score
|
||||
{
|
||||
ScoreInfo = new ScoreInfo { User = api.LocalUser.Value },
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Imports the player's <see cref="Scoring.Score"/> to the local database.
|
||||
|
Loading…
Reference in New Issue
Block a user