mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 15:52:54 +08:00
Pass GameplayStartTime to FrameStabilityContainer to allow bypassing prior to start
This commit is contained in:
parent
3f702d13a3
commit
66594b7a1b
@ -73,6 +73,26 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
checkFrameCount(2);
|
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]
|
[Test]
|
||||||
public void TestInitialSeek()
|
public void TestInitialSeek()
|
||||||
{
|
{
|
||||||
|
@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
frameStabilityContainer = new FrameStabilityContainer
|
frameStabilityContainer = new FrameStabilityContainer(GameplayStartTime)
|
||||||
{
|
{
|
||||||
Child = KeyBindingInputManager
|
Child = KeyBindingInputManager
|
||||||
.WithChild(CreatePlayfieldAdjustmentContainer()
|
.WithChild(CreatePlayfieldAdjustmentContainer()
|
||||||
|
@ -17,10 +17,14 @@ namespace osu.Game.Rulesets.UI
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class FrameStabilityContainer : Container, IHasReplayHandler
|
public class FrameStabilityContainer : Container, IHasReplayHandler
|
||||||
{
|
{
|
||||||
public FrameStabilityContainer()
|
private readonly double gameplayStartTime;
|
||||||
|
|
||||||
|
public FrameStabilityContainer(double gameplayStartTime = double.MinValue)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
gameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
|
gameplayClock = new GameplayClock(framedClock = new FramedClock(manualClock = new ManualClock()));
|
||||||
|
|
||||||
|
this.gameplayStartTime = gameplayStartTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
private readonly ManualClock manualClock;
|
private readonly ManualClock manualClock;
|
||||||
@ -116,6 +120,8 @@ namespace osu.Game.Rulesets.UI
|
|||||||
|
|
||||||
firstConsumption = false;
|
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)
|
else if (Math.Abs(manualClock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f)
|
||||||
{
|
{
|
||||||
newProposedTime = newProposedTime > manualClock.CurrentTime
|
newProposedTime = newProposedTime > manualClock.CurrentTime
|
||||||
|
Loading…
Reference in New Issue
Block a user