mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 18:27:26 +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);
|
||||
}
|
||||
|
||||
[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()
|
||||
{
|
||||
|
@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
frameStabilityContainer = new FrameStabilityContainer
|
||||
frameStabilityContainer = new FrameStabilityContainer(GameplayStartTime)
|
||||
{
|
||||
Child = KeyBindingInputManager
|
||||
.WithChild(CreatePlayfieldAdjustmentContainer()
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user