1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 06:47:24 +08:00

Pass GameplayStartTime to FrameStabilityContainer to allow bypassing prior to start

This commit is contained in:
Dean Herbert 2019-05-09 16:36:47 +09:00
parent 3f702d13a3
commit 66594b7a1b
3 changed files with 28 additions and 2 deletions

View File

@ -73,6 +73,26 @@ namespace osu.Game.Tests.Visual.Gameplay
checkFrameCount(2);
}
[Test]
public void TestInitialSeekWithGameplayStart()
{
seekManualTo(1000);
createStabilityContainer(30000);
confirmSeek(1000);
checkFrameCount(0);
seekManualTo(10000);
confirmSeek(10000);
checkFrameCount(1);
seekManualTo(130000);
confirmSeek(130000);
checkFrameCount(6002);
}
[Test]
public void TestInitialSeek()
{

View File

@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.UI
{
InternalChildren = new Drawable[]
{
frameStabilityContainer = new FrameStabilityContainer
frameStabilityContainer = new FrameStabilityContainer(GameplayStartTime)
{
Child = KeyBindingInputManager
.WithChild(CreatePlayfieldAdjustmentContainer()

View File

@ -17,10 +17,14 @@ namespace osu.Game.Rulesets.UI
/// </summary>
public class FrameStabilityContainer : Container, IHasReplayHandler
{
public FrameStabilityContainer()
private readonly double gameplayStartTime;
public FrameStabilityContainer(double gameplayStartTime = double.MinValue)
{
RelativeSizeAxes = Axes.Both;
gameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
this.gameplayStartTime = gameplayStartTime;
}
private readonly ManualClock manualClock;
@ -116,6 +120,8 @@ namespace osu.Game.Rulesets.UI
firstConsumption = false;
}
else if (manualClock.CurrentTime < gameplayStartTime)
manualClock.CurrentTime = newProposedTime = Math.Min(gameplayStartTime, newProposedTime);
else if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f)
{
newProposedTime = newProposedTime > manualClock.CurrentTime