Exemple #1
0
        public MenuResult Update(GameTime gameTime)
        {
            cooldown -= gameTime.ElapsedGameTime.Milliseconds;
            if (cooldown < 0)
            {
                cooldown = 0;
            }
            if (state == SummaryMenuState.WAIT && animateTime > 1000)
            {
                SoundEffects.PlayClick();
                result = MenuResult.GoToResults;
                String nextText = null;
                if (TutorialStage.controlLessonIndex == TutorialStage.introIndex)
                {
                    optionList = new List <MenuOption>();
                }
                else
                {
                    optionList = new List <MenuOption>();
                    optionList.Add(new MenuOption(MenuResult.GoToResults, "Continue"));
                }
                state    = SummaryMenuState.READY;
                nextText = TutorialStage.IntroText();
                text     = nextText;
                cooldown = 250;
            }
            if (state == SummaryMenuState.NURSEIN || state == SummaryMenuState.NURSEOUT || state == SummaryMenuState.WAIT)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
            }
            if (state == SummaryMenuState.NURSEIN && animateTime > 250)
            {
                state = SummaryMenuState.READY;
            }
            if (state == SummaryMenuState.NURSEOUT && animateTime > 250)
            {
                animateTime = 0;
                state       = SummaryMenuState.NURSEIN;
                return(result);
            }
            if (state == SummaryMenuState.READY && cooldown == 0)
            {
                GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
                Vector2      leftStick    = gamePadState.ThumbSticks.Left;
                Vector2      rightStick   = gamePadState.ThumbSticks.Right;
                if (!(TutorialStage.phase != TutorialPhase.None && TutorialStage.introIndex - 1 == TutorialStage.controlLessonIndex))
                {
                    if (Keyboard.GetState().IsKeyDown(Keys.Space) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start))
                    {
                        SoundEffects.PlayClick();
                        result = optionList[selectedOption].result;
                        String nextText = null;
                        if (TutorialStage.phase == TutorialPhase.Intro)
                        {
                            if (TutorialStage.controlLessonIndex == TutorialStage.introIndex)
                            {
                                optionList = new List <MenuOption>();
                            }
                            else
                            {
                                optionList = new List <MenuOption>();
                                optionList.Add(new MenuOption(MenuResult.GoToResults, "Continue"));
                            }
                            nextText = TutorialStage.IntroText();
                        }
                        else if (TutorialStage.phase == TutorialPhase.Pass)
                        {
                            nextText = TutorialStage.SuccessText();
                            if (TutorialStage.IsEndOfSection())
                            {
                                optionList = new List <MenuOption>();
                                optionList.Add(new MenuOption(MenuResult.GoToResults, "Continue"));
                                optionList.Add(new MenuOption(MenuResult.Replay, "Practice"));
                            }
                        }
                        else if (TutorialStage.phase == TutorialPhase.Fail)
                        {
                            nextText = TutorialStage.FailureText();
                            if (TutorialStage.IsEndOfSection())
                            {
                                optionList = new List <MenuOption>();
                                optionList.Add(new MenuOption(MenuResult.Replay, "Try Again"));
                                optionList.Add(new MenuOption(MenuResult.GoToMainMenu, "Main Menu"));
                            }
                        }
                        if (nextText != null)
                        {
                            text     = nextText;
                            cooldown = 250;
                        }
                        else
                        {
                            if ((TutorialStage.phase == TutorialPhase.Pass && result != MenuResult.Replay) || TutorialStage.phase == TutorialPhase.Fail)
                            {
                                return(result);
                            }
                            animateTime = 0;
                            state       = SummaryMenuState.NURSEOUT;
                        }
                    }

                    if (gamePadState.IsButtonDown(Buttons.DPadRight) || gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Right) || leftStick.X > Game.gameSettings.controlStickTrigger || rightStick.X > Game.gameSettings.controlStickTrigger)
                    {
                        SoundEffects.PlayClick();
                        selectedOption++;
                        if (selectedOption >= optionList.Count())
                        {
                            selectedOption = optionList.Count() - 1;
                        }
                        cooldown = 250;
                    }
                    if (gamePadState.IsButtonDown(Buttons.DPadLeft) || gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left) || leftStick.X < -Game.gameSettings.controlStickTrigger || rightStick.X < -Game.gameSettings.controlStickTrigger)
                    {
                        SoundEffects.PlayClick();
                        selectedOption--;
                        if (selectedOption < 0)
                        {
                            selectedOption = 0;
                        }
                        cooldown = 250;
                    }
                }
                else
                {
                    if (TutorialStage.restrictions == ControlRestrictions.StickOnly && (gamePadState.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState().IsKeyDown(Keys.Up) || gamePadState.ThumbSticks.Left.Y > Game.gameSettings.controlStickTrigger ||
                                                                                        gamePadState.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState().IsKeyDown(Keys.Down) || gamePadState.ThumbSticks.Left.Y < -Game.gameSettings.controlStickTrigger ||
                                                                                        gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left) || gamePadState.ThumbSticks.Left.X > Game.gameSettings.controlStickTrigger ||
                                                                                        gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Left) || gamePadState.ThumbSticks.Left.X < -Game.gameSettings.controlStickTrigger))
                    {
                        state       = SummaryMenuState.WAIT;
                        animateTime = 0;
                    }
                    if (TutorialStage.restrictions == ControlRestrictions.ShouldersOnly && (gamePadState.IsButtonDown(Buttons.LeftShoulder) || gamePadState.IsButtonDown(Buttons.RightShoulder) || Keyboard.GetState().IsKeyDown(Keys.A) || Keyboard.GetState().IsKeyDown(Keys.S)))
                    {
                        state       = SummaryMenuState.WAIT;
                        animateTime = 0;
                    }
                    if (TutorialStage.restrictions == ControlRestrictions.TriggersOnly && (gamePadState.IsButtonDown(Buttons.LeftTrigger) || gamePadState.IsButtonDown(Buttons.RightTrigger) || Keyboard.GetState().IsKeyDown(Keys.Q) || Keyboard.GetState().IsKeyDown(Keys.W)))
                    {
                        state       = SummaryMenuState.WAIT;
                        animateTime = 0;
                    }
                }
            }
            return(MenuResult.None);
        }
Exemple #2
0
        public MenuResult Update(GameTime gameTime)
        {
            cooldown -= gameTime.ElapsedGameTime.Milliseconds;
            if (cooldown < 0) cooldown = 0;
            if (state == SummaryMenuState.WAIT && animateTime > 1000)
            {
                SoundEffects.PlayClick();
                result = MenuResult.GoToResults;
                String nextText = null;
                if (TutorialStage.controlLessonIndex == TutorialStage.introIndex)
                {
                    optionList = new List<MenuOption>();
                }
                else
                {
                    optionList = new List<MenuOption>();
                    optionList.Add(new MenuOption(MenuResult.GoToResults, "Continue"));
                }
                state = SummaryMenuState.READY;
                nextText = TutorialStage.IntroText();
                text = nextText;
                cooldown = 250;
            }
            if (state == SummaryMenuState.NURSEIN || state == SummaryMenuState.NURSEOUT || state == SummaryMenuState.WAIT)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
            }
            if (state == SummaryMenuState.NURSEIN && animateTime > 250)
            {
                state = SummaryMenuState.READY;
            }
            if (state == SummaryMenuState.NURSEOUT && animateTime > 250)
            {
                animateTime = 0;
                state = SummaryMenuState.NURSEIN;
                return result;
            }
            if (state == SummaryMenuState.READY && cooldown == 0)
            {
                GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
                Vector2 leftStick = gamePadState.ThumbSticks.Left;
                Vector2 rightStick = gamePadState.ThumbSticks.Right;
                if (!(TutorialStage.phase != TutorialPhase.None && TutorialStage.introIndex - 1 == TutorialStage.controlLessonIndex))
                {
                    if (Keyboard.GetState().IsKeyDown(Keys.Space) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start))
                    {
                        SoundEffects.PlayClick();
                        result = optionList[selectedOption].result;
                        String nextText = null;
                        if (TutorialStage.phase == TutorialPhase.Intro)
                        {
                            if (TutorialStage.controlLessonIndex == TutorialStage.introIndex)
                            {
                                optionList = new List<MenuOption>();
                            }
                            else
                            {
                                optionList = new List<MenuOption>();
                                optionList.Add(new MenuOption(MenuResult.GoToResults, "Continue"));
                            }
                            nextText = TutorialStage.IntroText();
                        }
                        else if (TutorialStage.phase == TutorialPhase.Pass)
                        {
                            nextText = TutorialStage.SuccessText();
                            if (TutorialStage.IsEndOfSection())
                            {
                                optionList = new List<MenuOption>();
                                optionList.Add(new MenuOption(MenuResult.GoToResults, "Continue"));
                                optionList.Add(new MenuOption(MenuResult.Replay, "Practice"));
                            }
                        }
                        else if (TutorialStage.phase == TutorialPhase.Fail)
                        {
                            nextText = TutorialStage.FailureText();
                            if (TutorialStage.IsEndOfSection())
                            {
                                optionList = new List<MenuOption>();
                                optionList.Add(new MenuOption(MenuResult.Replay, "Try Again"));
                                optionList.Add(new MenuOption(MenuResult.GoToMainMenu, "Main Menu"));
                            }
                        }
                        if (nextText != null)
                        {
                            text = nextText;
                            cooldown = 250;
                        }
                        else
                        {
                            if ((TutorialStage.phase == TutorialPhase.Pass && result != MenuResult.Replay) || TutorialStage.phase == TutorialPhase.Fail)
                            {
                                return result;
                            }
                            animateTime = 0;
                            state = SummaryMenuState.NURSEOUT;

                        }
                    }

                    if (gamePadState.IsButtonDown(Buttons.DPadRight) || gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Right) || leftStick.X > Game.gameSettings.controlStickTrigger || rightStick.X > Game.gameSettings.controlStickTrigger)
                    {
                        SoundEffects.PlayClick();
                        selectedOption++;
                        if (selectedOption >= optionList.Count())
                            selectedOption = optionList.Count() - 1;
                        cooldown = 250;
                    }
                    if (gamePadState.IsButtonDown(Buttons.DPadLeft) || gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left) || leftStick.X < -Game.gameSettings.controlStickTrigger || rightStick.X < -Game.gameSettings.controlStickTrigger)
                    {
                        SoundEffects.PlayClick();
                        selectedOption--;
                        if (selectedOption < 0)
                            selectedOption = 0;
                        cooldown = 250;
                    }
                }
                else
                {
                    if (TutorialStage.restrictions==ControlRestrictions.StickOnly && (gamePadState.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState().IsKeyDown(Keys.Up) || gamePadState.ThumbSticks.Left.Y > Game.gameSettings.controlStickTrigger ||
                        gamePadState.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState().IsKeyDown(Keys.Down) || gamePadState.ThumbSticks.Left.Y < -Game.gameSettings.controlStickTrigger ||
                        gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left) || gamePadState.ThumbSticks.Left.X > Game.gameSettings.controlStickTrigger ||
                        gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Left) || gamePadState.ThumbSticks.Left.X < -Game.gameSettings.controlStickTrigger))
                    {
                        state = SummaryMenuState.WAIT;
                        animateTime = 0;
                    }
                    if (TutorialStage.restrictions == ControlRestrictions.ShouldersOnly && (gamePadState.IsButtonDown(Buttons.LeftShoulder) || gamePadState.IsButtonDown(Buttons.RightShoulder) || Keyboard.GetState().IsKeyDown(Keys.A) || Keyboard.GetState().IsKeyDown(Keys.S)))
                    {
                        state = SummaryMenuState.WAIT;
                        animateTime = 0;
                    }
                    if (TutorialStage.restrictions == ControlRestrictions.TriggersOnly && (gamePadState.IsButtonDown(Buttons.LeftTrigger) || gamePadState.IsButtonDown(Buttons.RightTrigger) || Keyboard.GetState().IsKeyDown(Keys.Q) || Keyboard.GetState().IsKeyDown(Keys.W)))
                    {
                        state = SummaryMenuState.WAIT;
                        animateTime = 0;
                    }
                }
            }
            return MenuResult.None;
        }