mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Hook up seeking flow
This commit is contained in:
parent
0c433cda86
commit
b80768b44a
@ -562,6 +562,12 @@ namespace osu.Game.Screens.Play
|
|||||||
updateSampleDisabledState();
|
updateSampleDisabledState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Seek to a specific time in gameplay.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="time">The destination time to seek to.</param>
|
||||||
|
public void Seek(double time) => GameplayClockContainer.Seek(time);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Restart gameplay via a parent <see cref="PlayerLoader"/>.
|
/// Restart gameplay via a parent <see cref="PlayerLoader"/>.
|
||||||
/// <remarks>This can be called from a child screen in order to trigger the restart process.</remarks>
|
/// <remarks>This can be called from a child screen in order to trigger the restart process.</remarks>
|
||||||
|
@ -66,7 +66,13 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public IClock ReferenceClock;
|
[Resolved(canBeNull: true)]
|
||||||
|
private Player player { get; set; }
|
||||||
|
|
||||||
|
[Resolved(canBeNull: true)]
|
||||||
|
private GameplayClock gameplayClock { get; set; }
|
||||||
|
|
||||||
|
private IClock referenceClock;
|
||||||
|
|
||||||
public SongProgress()
|
public SongProgress()
|
||||||
{
|
{
|
||||||
@ -99,24 +105,13 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
OnSeek = seek,
|
OnSeek = time => player?.Seek(time),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private void seek(double time)
|
|
||||||
{
|
|
||||||
if (gameplayClock == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
// TODO: implement
|
|
||||||
}
|
|
||||||
|
|
||||||
[Resolved(canBeNull: true)]
|
|
||||||
private GameplayClock gameplayClock { get; set; }
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(OsuColour colours, OsuConfigManager config, DrawableRuleset drawableRuleset)
|
private void load(OsuColour colours, OsuConfigManager config, DrawableRuleset drawableRuleset)
|
||||||
{
|
{
|
||||||
@ -125,6 +120,8 @@ namespace osu.Game.Screens.Play
|
|||||||
if (drawableRuleset != null)
|
if (drawableRuleset != null)
|
||||||
{
|
{
|
||||||
AllowSeeking.BindTo(drawableRuleset.HasReplayLoaded);
|
AllowSeeking.BindTo(drawableRuleset.HasReplayLoaded);
|
||||||
|
|
||||||
|
referenceClock = drawableRuleset.FrameStableClock;
|
||||||
Objects = drawableRuleset.Objects;
|
Objects = drawableRuleset.Objects;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,7 +156,7 @@ namespace osu.Game.Screens.Play
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
double gameplayTime = gameplayClock?.CurrentTime ?? Time.Current;
|
double gameplayTime = gameplayClock?.CurrentTime ?? Time.Current;
|
||||||
double frameStableTime = ReferenceClock?.CurrentTime ?? gameplayTime;
|
double frameStableTime = referenceClock?.CurrentTime ?? gameplayTime;
|
||||||
|
|
||||||
double progress = Math.Min(1, (frameStableTime - firstHitTime) / (lastHitTime - firstHitTime));
|
double progress = Math.Min(1, (frameStableTime - firstHitTime) / (lastHitTime - firstHitTime));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user