Ejemplo n.º 1
0
        public void TestKeySelectionAfterMouseSelection()
        {
            AddStep("Show overlay", () =>
            {
                pauseOverlay.Show();
            });

            AddStep("Hover second button", () => InputManager.MoveMouseTo(getButton(1)));
            AddStep("Up arrow", () => InputManager.Key(Key.Up));
            AddAssert("Second button not selected", () => !getButton(1).Selected.Value);
            AddAssert("First button selected", () => getButton(0).Selected.Value);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred.
        /// </summary>
        private void testEnterWithoutSelection()
        {
            AddStep("Show overlay", () => pauseOverlay.Show());

            AddStep("Press select", () => press(GlobalAction.Select));
            AddAssert("Overlay still open", () => pauseOverlay.State == Visibility.Visible);

            AddStep("Hide overlay", () => pauseOverlay.Hide());
        }
Ejemplo n.º 3
0
        public override void HandleInput(InputHelper inputHelper)
        {
            if (pauseOverlay.Visible)
            {
                pauseOverlay.HandleInput(inputHelper);
                return;
            }

            if (continueOverlay.Visible)
            {
                continueOverlay.HandleInput(inputHelper);
                return;
            }

            if (endGameOverlay.Visible)
            {
                endGameOverlay.HandleInput(inputHelper);
                return;
            }



            base.HandleInput(inputHelper);

            if (pauseButton.Pressed)
            {
                ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click");
                pauseOverlay.IsGuide = false;
                pauseOverlay.Show();
            }

            if (guideButton.Pressed)
            {
                ExtendedGame.AssetManager.PlaySoundEffect("Sounds/snd_click");
                pauseOverlay.IsGuide = true;
                pauseOverlay.Show();
            }
        }
Ejemplo n.º 4
0
        public override void Reset()
        {
            base.Reset();

            retryCount = 0;

            Add(pauseOverlay = new PauseOverlay
            {
                OnResume = () => Logger.Log(@"Resume"),
                OnRetry  = () => Logger.Log(@"Retry"),
                OnQuit   = () => Logger.Log(@"Quit"),
            });
            Add(failOverlay = new FailOverlay
            {
                OnRetry = () => Logger.Log(@"Retry"),
                OnQuit  = () => Logger.Log(@"Quit"),
            });

            AddStep(@"Pause", delegate {
                if (failOverlay.State == Visibility.Visible)
                {
                    failOverlay.Hide();
                }
                pauseOverlay.Show();
            });
            AddStep("Fail", delegate {
                if (pauseOverlay.State == Visibility.Visible)
                {
                    pauseOverlay.Hide();
                }
                failOverlay.Show();
            });
            AddStep("Add Retry", delegate
            {
                retryCount++;
                pauseOverlay.Retries = retryCount;
                failOverlay.Retries  = retryCount;
            });
        }
Ejemplo n.º 5
0
        protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
        {
            switch (args.Key)
            {
            case Key.Number3:
            {
                circle1.TriggerOnClick();
                break;
            }

            case Key.E:
            {
                circle2.TriggerOnClick();
                break;
            }

            case Key.D:
            {
                circle3.TriggerOnClick();
                break;
            }

            case Key.C:
            {
                circle4.TriggerOnClick();
                break;
            }

            case Key.V:
            {
                circle5.TriggerOnClick();
                break;
            }

            case Key.B:
            {
                circle6.TriggerOnClick();
                break;
            }

            case Key.H:
            {
                circle7.TriggerOnClick();
                break;
            }

            case Key.U:
            {
                circle8.TriggerOnClick();
                break;
            }

            case Key.Number7:
            {
                circle9.TriggerOnClick();
                break;
            }

            case Key.Escape:
            {
                pauseOverlay.Show();
                break;
            }
            }

            return(base.OnKeyDown(state, args));
        }