Esempio n. 1
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            masterClockContainer.Reset();
            masterClockContainer.Stop();

            syncManager.ReadyToStart += onReadyToStart;
            syncManager.MasterState.BindValueChanged(onMasterStateChanged, true);
        }
Esempio n. 2
0
        protected override void LoadComplete()
        {
            base.LoadComplete();

            masterClockContainer.Stop();
            masterClockContainer.Reset();
        }
        public void TestSeekPerformsInGameplayTime(
            [Values(1.0, 0.5, 2.0)] double clockRate,
            [Values(0.0, 200.0, -200.0)] double userOffset,
            [Values(false, true)] bool whileStopped)
        {
            ClockBackedTestWorkingBeatmap working = null;
            GameplayClockContainer        gameplayClockContainer = null;

            AddStep("create container", () =>
            {
                working = new ClockBackedTestWorkingBeatmap(new OsuRuleset().RulesetInfo, new FramedClock(new ManualClock()), Audio);
                working.LoadTrack();

                Add(gameplayClockContainer = new MasterGameplayClockContainer(working, 0));

                if (whileStopped)
                {
                    gameplayClockContainer.Stop();
                }

                gameplayClockContainer.Reset();
            });

            AddStep($"set clock rate to {clockRate}", () => working.Track.AddAdjustment(AdjustableProperty.Frequency, new BindableDouble(clockRate)));
            AddStep($"set audio offset to {userOffset}", () => localConfig.SetValue(OsuSetting.AudioOffset, userOffset));

            AddStep("seek to 2500", () => gameplayClockContainer.Seek(2500));
            AddAssert("gameplay clock time = 2500", () => Precision.AlmostEquals(gameplayClockContainer.CurrentTime, 2500, 10f));

            AddStep("seek to 10000", () => gameplayClockContainer.Seek(10000));
            AddAssert("gameplay clock time = 10000", () => Precision.AlmostEquals(gameplayClockContainer.CurrentTime, 10000, 10f));
        }
Esempio n. 4
0
        private void onMasterStateChanged(ValueChangedEvent <MasterClockState> state)
        {
            switch (state.NewValue)
            {
            case MasterClockState.Synchronised:
                if (canStartMasterClock)
                {
                    masterClockContainer.Start();
                }

                break;

            case MasterClockState.TooFarAhead:
                masterClockContainer.Stop();
                break;
            }
        }