Пример #1
0
 public void SelectDown()
 {
     if (selectedIndex < optionList.Count - 1)
     {
         SoundEffects.PlayMove();
         state         = MenuState.AnimateDown;
         animationTime = 0;
         selectedIndex++;
     }
 }
Пример #2
0
 public void SelectUp()
 {
     if (selectedIndex > 0)
     {
         SoundEffects.PlayMove();
         state         = MenuState.AnimateUp;
         animationTime = 0;
         selectedIndex--;
     }
 }
Пример #3
0
        public MenuResult Update(GameTime gameTime)
        {
            cooldown -= gameTime.ElapsedGameTime.Milliseconds;
            if (cooldown < 0)
            {
                cooldown = 0;
            }
            animateTime += gameTime.ElapsedGameTime.Milliseconds;

            if (state == TutorialLauncherState.ZOOM && animateTime > maxAnimateTime)
            {
                state       = TutorialLauncherState.NURSEIN;
                animateTime = 0;
            }
            if (state == TutorialLauncherState.NURSEIN && animateTime > maxAnimateTime)
            {
                state = TutorialLauncherState.NURSETEXT;
            }
            if (state == TutorialLauncherState.NURSETEXT)
            {
                if (Keyboard.GetState().IsKeyDown(Keys.Space) || GamePad.GetState(Game.playerIndex).IsButtonDown(Buttons.A))
                {
                    state       = TutorialLauncherState.DOCTORIN;
                    animateTime = 0;
                }
            }
            if (state == TutorialLauncherState.DOCTORIN && animateTime > maxAnimateTime)
            {
                state = TutorialLauncherState.DOCTORTEXT;
            }
            if (state == TutorialLauncherState.DOCTORTEXT)
            {
                if (Keyboard.GetState().IsKeyDown(Keys.Space) || GamePad.GetState(Game.playerIndex).IsButtonDown(Buttons.A))
                {
                    SoundEffects.PlayClick();
                    state       = TutorialLauncherState.DOCTOROUT;
                    animateTime = 0;
                }
            }
            if (state == TutorialLauncherState.DOCTOROUT && animateTime > maxAnimateTime)
            {
                state = TutorialLauncherState.FINALTEXT;
            }
            if (state == TutorialLauncherState.FINALTEXT)
            {
                if (Keyboard.GetState().IsKeyDown(Keys.Space) || GamePad.GetState(Game.playerIndex).IsButtonDown(Buttons.A))
                {
                    return(MenuResult.StartTutorial);
                }
            }
            return(MenuResult.None);
        }
Пример #4
0
 public void Draw()
 {
     if (enabled)
     {
         TimeSpan t = new TimeSpan(0, 0, 0, 0, timeRemaining);
         if (t.Minutes == 0 && t.Seconds < 10)
         {
             if (mostRecentValue != t.Seconds)
             {
                 SoundEffects.PlayAlert();
             }
             mostRecentValue = t.Seconds;
             Game.spriteBatch.DrawString(Game.spriteFont, string.Format("TIME  {0}:{1:D2}", t.Minutes, t.Seconds), new Vector2(posX, posY - 5), Color.Red, 0, Vector2.Zero, 1.3f, SpriteEffects.None, 0);
         }
         else
         {
             Game.spriteBatch.DrawString(Game.spriteFont, string.Format("TIME  {0}:{1:D2}", t.Minutes, t.Seconds), new Vector2(posX, posY), Color.White);
         }
     }
 }
Пример #5
0
        public MenuResult Update(GameTime gameTime)
        {
            if (state == MenuState.Ready)
            {
                GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
                Vector2      leftStick    = gamePadState.ThumbSticks.Left;
                Vector2      rightStick   = gamePadState.ThumbSticks.Right;
                if (gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState().IsKeyDown(Keys.Down) || leftStick.Y < -Game.gameSettings.controlStickTrigger || rightStick.Y < -Game.gameSettings.controlStickTrigger)
                {
                    SelectDown();
                }
                else if (gamePadState.IsButtonDown(Buttons.DPadUp) || gamePadState.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState().IsKeyDown(Keys.Up) || leftStick.Y > Game.gameSettings.controlStickTrigger || rightStick.Y > Game.gameSettings.controlStickTrigger)
                {
                    SelectUp();
                }
                else if (Keyboard.GetState().IsKeyDown(Keys.B) || gamePadState.IsButtonDown(Buttons.B))
                {
                    return(MenuResult.GoToMainMenu);
                }
                else if (gamePadState.IsButtonDown(Buttons.DPadRight) || gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Right))
                {
                    if (optionList[selectedIndex].type == MenuType.ColorSelect)
                    {
                        numColors++;
                        if (numColors > 10)
                        {
                            numColors = 1;
                        }
                    }
                    if (optionList[selectedIndex].type == MenuType.TimerFreq)
                    {
                        timerFreq++;
                        timerFreq %= 4;
                    }
                    if (optionList[selectedIndex].type == MenuType.CounterFreq)
                    {
                        counterFreq++;
                        counterFreq %= 4;
                    }
                    if (optionList[selectedIndex].type == MenuType.ToggleFreq)
                    {
                        toggleFreq++;
                        toggleFreq %= 4;
                    }
                    state = MenuState.Wait;
                }
                else if (gamePadState.IsButtonDown(Buttons.DPadLeft) || gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left))
                {
                    if (optionList[selectedIndex].type == MenuType.ColorSelect)
                    {
                        numColors--;
                        if (numColors < 1)
                        {
                            numColors = 6;
                        }
                    }
                    if (optionList[selectedIndex].type == MenuType.TimerFreq)
                    {
                        timerFreq--;
                        if (timerFreq < 0)
                        {
                            timerFreq = 3;
                        }
                    }
                    if (optionList[selectedIndex].type == MenuType.CounterFreq)
                    {
                        counterFreq--;
                        if (counterFreq < 0)
                        {
                            counterFreq = 3;
                        }
                    }
                    if (optionList[selectedIndex].type == MenuType.ToggleFreq)
                    {
                        toggleFreq--;
                        if (toggleFreq < 0)
                        {
                            toggleFreq = 3;
                        }
                    }
                    state = MenuState.Wait;
                    state = MenuState.Wait;
                }
                else if (Keyboard.GetState().IsKeyDown(Keys.Space) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start))
                {
                    if (optionList[selectedIndex].type == MenuType.ColorSelect)
                    {
                        numColors++;
                        if (numColors > 6)
                        {
                            numColors = 1;
                        }
                    }
                    if (optionList[selectedIndex].type == MenuType.HelpToggle)
                    {
                        SoundEffects.PlayClick();
                        Game.gameSettings.displayControls = !Game.gameSettings.displayControls;
                    }
                    if (optionList[selectedIndex].type == MenuType.FullScreenToggle)
                    {
                        SoundEffects.PlayClick();
                        if (Game.gameSettings.fullScreen)
                        {
                            Game.gameSettings.fullScreen = false;
                            Game.UpdateResolution();
                        }
                        else
                        {
                            Game.gameSettings.fullScreen = true;
                            Game.UpdateResolution();
                        }
                    }
                    if (optionList[selectedIndex].type == MenuType.WideScreenToggle)
                    {
                        SoundEffects.PlayClick();
                        if (Game.gameSettings.wideScreen)
                        {
                            Game.gameSettings.wideScreen = false;
                            Game.UpdateResolution();
                        }
                        else
                        {
                            Game.gameSettings.wideScreen = true;
                            Game.UpdateResolution();
                        }
                    }
                    if (optionList[selectedIndex].type == MenuType.MusicToggle)
                    {
                        SoundEffects.PlayClick();
                        if (Game.gameSettings.musicEnabled)
                        {
                            Game.gameSettings.musicEnabled = false;
                            MusicControl.Stop();
                        }
                        else
                        {
                            Game.gameSettings.musicEnabled = true;
                            MusicControl.PlayMenuMusic();
                        }
                    }
                    if (optionList[selectedIndex].type == MenuType.SoundToggle)
                    {
                        Game.gameSettings.soundEffectsEnabled = !Game.gameSettings.soundEffectsEnabled;
                        SoundEffects.PlayClick();
                    }
                    if (optionList[selectedIndex].type == MenuType.TimerFreq)
                    {
                        timerFreq++;
                        timerFreq %= 4;
                    }
                    if (optionList[selectedIndex].type == MenuType.CounterFreq)
                    {
                        counterFreq++;
                        counterFreq %= 4;
                    }
                    if (optionList[selectedIndex].type == MenuType.ToggleFreq)
                    {
                        toggleFreq++;
                        toggleFreq %= 4;
                    }
                    state = MenuState.Wait;
                    return(optionList[selectedIndex].result);
                }
            }
            else
            {
                animationTime += gameTime.ElapsedGameTime.Milliseconds;
            }

            if (animationTime > maxAnimationTime)
            {
                animationTime = 0;
                state         = MenuState.Ready;
            }
            return(MenuResult.None);
        }
Пример #6
0
        public MenuResult Update(GameTime gameTime)
        {
            if (state == SelectMenuState.SWAPLEFT || state == SelectMenuState.SWAPRIGHT)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;

                if (animateTime > swapTime)
                {
                    // Update currentLevel
                    if (levelList[currentLevel].mode == GameMode.TimeAttack)
                    {
                        Game.gameSettings.timeAttackViewLevel = currentLevel;
                    }
                    if (levelList[currentLevel].mode == GameMode.Puzzle)
                    {
                        Game.gameSettings.puzzleViewLevel = currentLevel;
                    }
                    if (levelList[currentLevel].mode == GameMode.MoveChallenge)
                    {
                        Game.gameSettings.moveChallengeViewLevel = currentLevel;
                    }
                    state       = SelectMenuState.READY;
                    animateTime = swapTime;
                }
            }

            if (state == SelectMenuState.SELECTING)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
                if (animateTime > 1000)
                {
                    animateTime = 1000;
                    state       = SelectMenuState.READY;
                    return(MenuResult.StartTimeAttack);
                }
            }
            if (state == SelectMenuState.LOAD)
            {
                state = SelectMenuState.READY;
                MusicControl.PlayMenuMusic();
                highScoreData = HighScoreTracker.LoadHighScores();
            }
            if (state == SelectMenuState.DOCTORIN)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
                if (animateTime > 500)
                {
                    animateTime      = 500;
                    state            = SelectMenuState.TEXT;
                    currentTextPiece = 0;
                }
            }
            if (state == SelectMenuState.DOCTOROUT)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
                if (animateTime > 500)
                {
                    animateTime = 0;
                    LevelData levelData = GetLevelData(currentLevel);
                    if (levelData.unlocked && !(Guide.IsTrialMode && levelList[currentLevel].fullVersionOnly))
                    {
                        state = SelectMenuState.SELECTING;
                    }
                    else
                    {
                        state = SelectMenuState.READY;
                    }
                    currentTextPiece = 0;
                }
            }
            cooldown -= gameTime.ElapsedGameTime.Milliseconds;
            if (cooldown <= 0)
            {
                cooldown = 0;
                GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
                Vector2      leftStick    = gamePadState.ThumbSticks.Left;
                Vector2      rightStick   = gamePadState.ThumbSticks.Right;

                if (state == SelectMenuState.TEXT)
                {
                    if (Keyboard.GetState().IsKeyDown(Keys.Space) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start))
                    {
                        SoundEffects.PlayClick();
                        LevelData levelData = GetLevelData(currentLevel);
                        if (levelData.unlocked == false || (Guide.IsTrialMode && levelList[currentLevel].fullVersionOnly))
                        {
                            state = SelectMenuState.DOCTOROUT;
                        }
                        currentTextPiece++;
                        animateTime = 0;
                        if (currentTextPiece == textPieces.Count())
                        {
                            state = SelectMenuState.DOCTOROUT;
                        }
                        else
                        {
                            cooldown = 250;
                        }
                    }
                }
                if (state == SelectMenuState.READY)
                {
                    if (gamePadState.IsButtonDown(Buttons.DPadLeft) || gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left) || leftStick.X < -Game.gameSettings.controlStickTrigger || rightStick.X < -Game.gameSettings.controlStickTrigger)
                    {
                        if (currentLevel > 0)
                        {
                            SoundEffects.PlayMove();
                            if (!left)
                            {
                                numSwaps = 0;
                            }
                            numSwaps++;
                            if (numSwaps > 1)
                            {
                                swapTime = 400;
                            }
                            if (numSwaps > 2)
                            {
                                swapTime = 200;
                            }

                            left  = true;
                            state = SelectMenuState.SWAPLEFT;
                            currentLevel--;
                            animateTime = 0;
                        }
                    }
                    if (gamePadState.IsButtonDown(Buttons.DPadRight) || gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Right) || leftStick.X > Game.gameSettings.controlStickTrigger || rightStick.X > Game.gameSettings.controlStickTrigger)
                    {
                        if (currentLevel < levelList.Count - 1)
                        {
                            SoundEffects.PlayMove();
                            if (left)
                            {
                                numSwaps = 0;
                            }
                            numSwaps++;
                            if (numSwaps > 1)
                            {
                                swapTime = 400;
                            }
                            if (numSwaps > 2)
                            {
                                swapTime = 200;
                            }

                            left  = false;
                            state = SelectMenuState.SWAPRIGHT;
                            currentLevel++;
                            animateTime = 0;
                        }
                    }
                    if (Keyboard.GetState().IsKeyDown(Keys.B) || gamePadState.IsButtonDown(Buttons.B))
                    {
                        SoundEffects.PlayMove();
                        return(MenuResult.GoToMainMenu);
                    }
                    if (Keyboard.GetState().IsKeyDown(Keys.Space) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start))
                    {
                        SoundEffects.PlayScore();
                        textPieces = levelList[currentLevel].instructions.Split('-');
                        if (textPieces.Count() <= 1)
                        {
                            LevelData levelData = GetLevelData(currentLevel);
                            if (levelData.unlocked && !(Guide.IsTrialMode && levelList[currentLevel].fullVersionOnly))
                            {
                                state = SelectMenuState.SELECTING;
                            }
                            else
                            {
                                state = SelectMenuState.DOCTORIN;
                            }
                        }
                        else
                        {
                            state = SelectMenuState.DOCTORIN;
                        }
                        animateTime = 0;
                    }
                    if (state == SelectMenuState.READY)
                    {
                        numSwaps = 0;
                        swapTime = 500;
                    }
                }
            }
            return(MenuResult.None);
        }
Пример #7
0
 public MenuResult Update(GameTime gameTime)
 {
     cooldown -= gameTime.ElapsedGameTime.Milliseconds;
     if (cooldown < 0)
     {
         cooldown = 0;
     }
     if (state == PauseMenuState.NURSEIN || state == PauseMenuState.NURSEOUT)
     {
         animateTime += gameTime.ElapsedGameTime.Milliseconds;
     }
     if (state == PauseMenuState.NURSEIN && animateTime > 250)
     {
         state = PauseMenuState.READY;
     }
     if (state == PauseMenuState.NURSEOUT && animateTime > 250)
     {
         animateTime = 0;
         state       = PauseMenuState.NURSEIN;
         return(result);
     }
     if (state == PauseMenuState.READY && cooldown == 0)
     {
         GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
         Vector2      leftStick    = gamePadState.ThumbSticks.Left;
         Vector2      rightStick   = gamePadState.ThumbSticks.Right;
         if (Keyboard.GetState().IsKeyDown(Keys.Space) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start))
         {
             result      = optionList[selectedOption].result;
             animateTime = 0;
             state       = PauseMenuState.NURSEOUT;
             SoundEffects.PlayMove();
         }
         if (gamePadState.IsButtonDown(Buttons.DPadRight) || gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Right) || leftStick.X > Game.gameSettings.controlStickTrigger || rightStick.X > Game.gameSettings.controlStickTrigger)
         {
             selectedOption++;
             SoundEffects.PlayClick();
             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)
         {
             selectedOption--;
             SoundEffects.PlayClick();
             if (selectedOption < 0)
             {
                 selectedOption = 0;
             }
             cooldown = 250;
         }
         if (gamePadState.IsButtonDown(Buttons.B))
         {
             result      = MenuResult.ResumeGame;
             animateTime = 0;
             state       = PauseMenuState.NURSEOUT;
             SoundEffects.PlayMove();
         }
     }
     return(MenuResult.None);
 }
Пример #8
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);
        }
Пример #9
0
        public MenuResult Update(GameTime gameTime)
        {
            if (Guide.IsTrialMode == false)
            {
                RemovePurchase();
            }
            cooldown -= gameTime.ElapsedGameTime.Milliseconds;
            if (cooldown < 0)
            {
                cooldown = 0;
            }
            if (state == MainMenuState.DOCTORIN || state == MainMenuState.DOCTOROUT || state == MainMenuState.ANIMATEDOWN || state == MainMenuState.ANIMATEUP)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
            }
            if (state == MainMenuState.DOCTORIN && animateTime > 250)
            {
                MusicControl.PlayMenuMusic();
                state = MainMenuState.READY;
            }
            if (state == MainMenuState.DOCTOROUT && animateTime > 250)
            {
                animateTime = 0;
                state       = MainMenuState.DOCTORIN;
                return(result);
            }
            if (state == MainMenuState.ANIMATEDOWN && animateTime > 250)
            {
                animateTime = 0;
                state       = MainMenuState.READY;
            }
            if (state == MainMenuState.ANIMATEUP && animateTime > 250)
            {
                animateTime = 0;
                state       = MainMenuState.READY;
            }
            if (state == MainMenuState.READY && cooldown == 0)
            {
                GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
                Vector2      leftStick    = gamePadState.ThumbSticks.Left;
                Vector2      rightStick   = gamePadState.ThumbSticks.Right;
                if (gamePadState.IsButtonDown(Buttons.B))
                {
                    return(MenuResult.ReturnToSplashScreen);
                }
                if (Keyboard.GetState().IsKeyDown(Keys.Space) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start))
                {
                    SoundEffects.PlayScore();
                    result      = optionList[selectedIndex].result;
                    animateTime = 0;
                    if (result == MenuResult.BuyFullGame)
                    {
                        return(result);
                    }
                    state = MainMenuState.DOCTOROUT;
                }
                if (gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState().IsKeyDown(Keys.Down) || leftStick.Y < -Game.gameSettings.controlStickTrigger || rightStick.Y < -Game.gameSettings.controlStickTrigger)
                {
                    if (selectedIndex < optionList.Count() - 1)
                    {
                        SoundEffects.PlayMove();
                        state       = MainMenuState.ANIMATEDOWN;
                        animateTime = 0;
                        selectedIndex++;
                        cooldown = 250;
                    }
                }
                if (gamePadState.IsButtonDown(Buttons.DPadUp) || gamePadState.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState().IsKeyDown(Keys.Up) || leftStick.Y > Game.gameSettings.controlStickTrigger || rightStick.Y > Game.gameSettings.controlStickTrigger)
                {
                    if (selectedIndex > 0)
                    {
                        SoundEffects.PlayMove();
                        state       = MainMenuState.ANIMATEUP;
                        animateTime = 0;

                        selectedIndex--;
                        cooldown = 250;
                    }
                }
            }
            return(MenuResult.None);
        }
Пример #10
0
        public MenuResult Update(GameTime gameTime)
        {
            cooldown -= gameTime.ElapsedGameTime.Milliseconds;
            if (cooldown < 0)
            {
                cooldown = 0;
            }
            if (state == GameOverMenuState.SCORECHECK)
            {
                currentCharacter = 0;
                rank             = -1;
                HighScoreData highScoreData = HighScoreTracker.LoadHighScores();
                if (Game.currentSettings.mode == GameMode.TimeAttack)
                {
                    levelData = highScoreData.timeAttackLevels[level];
                    highScoreData.timeAttackLevels[level].played = true;
                    if (highScoreData.timeAttackLevels[level].rank < 3 && score >= Game.currentSettings.three_star)
                    {
                        congratulationsMessage = "Outstanding job! This patient has made a full \nrecovery, giving you the top ranking! Way to go!";
                        highScoreData.timeAttackLevels[level].rank = 3;
                    }
                    else if (highScoreData.timeAttackLevels[level].rank < 2 && score >= Game.currentSettings.two_star)
                    {
                        congratulationsMessage = "Great job! You've earned two stars! Try to score\n" + Game.currentSettings.three_star + " points to make it to the next rank!";
                        highScoreData.timeAttackLevels[level].rank = 2;
                    }
                    else if (highScoreData.timeAttackLevels[level].rank == 0)
                    {
                        highScoreData.timeAttackLevels[level].rank = 1;
                        congratulationsMessage = "Good job! You've earned one star! Try to score " + Game.currentSettings.two_star + " \npoints to make it to the next rank!";
                    }
                    else if (highScoreData.timeAttackLevels[level].rank == 3)
                    {
                        congratulationsMessage = "This patient has already made a full recovery! \nYou should see if you can beat your high score!";
                    }
                    else if (highScoreData.timeAttackLevels[level].rank == 2)
                    {
                        congratulationsMessage = "Try to score " + Game.currentSettings.three_star + " points to earn three \nstars!";
                    }
                    else if (highScoreData.timeAttackLevels[level].rank == 1)
                    {
                        congratulationsMessage = "Try to score " + Game.currentSettings.two_star + " points to earn two \nstars!";
                    }
                    else
                    {
                        congratulationsMessage = "BUG!";
                    }

                    for (int i = 4; i >= 0; i--)
                    {
                        if (score >= levelData.highScores[i])
                        {
                            if (i < 4)
                            {
                                levelData.highScores[i + 1]  = levelData.highScores[i];
                                levelData.playerNames[i + 1] = levelData.playerNames[i];
                            }
                            initials = levelData.playerNames[i];
                            rank     = i;
                            levelData.highScores[i] = score;
                        }
                    }
                    if (score >= Game.currentSettings.two_star && level < highScoreData.timeAttackLevels.Count() - 1)
                    {
                        if (highScoreData.timeAttackLevels[level + 1] != null)
                        {
                            highScoreData.timeAttackLevels[level + 1].unlocked = true;
                        }
                    }
                }
                if (Game.currentSettings.mode == GameMode.MoveChallenge)
                {
                    levelData = highScoreData.moveChallengeLevels[level];
                    highScoreData.moveChallengeLevels[level].played = true;
                    if (highScoreData.moveChallengeLevels[level].rank < 3 && score >= Game.currentSettings.three_star)
                    {
                        congratulationsMessage = "Outstanding job! This patient has made a full \nrecovery, giving you the top ranking! Way to go!";
                        highScoreData.moveChallengeLevels[level].rank = 3;
                    }
                    else if (highScoreData.moveChallengeLevels[level].rank < 2 && score >= Game.currentSettings.two_star)
                    {
                        congratulationsMessage = "Great job! You've earned two stars! Try to score \n" + Game.currentSettings.three_star + " points to make it to the next rank!";
                        highScoreData.moveChallengeLevels[level].rank = 2;
                    }
                    else if (highScoreData.moveChallengeLevels[level].rank == 0)
                    {
                        highScoreData.moveChallengeLevels[level].rank = 1;
                        congratulationsMessage = "Good job! You've earned one star! Try to score " + Game.currentSettings.two_star + " \npoints to make it to the next rank!";
                    }
                    else if (highScoreData.moveChallengeLevels[level].rank == 3)
                    {
                        congratulationsMessage = "This patient has already made a full recovery! \nYou should see if you can beat your high score!";
                    }
                    else if (highScoreData.moveChallengeLevels[level].rank == 2)
                    {
                        congratulationsMessage = "Try to score " + Game.currentSettings.three_star + " points to earn three \nstars!";
                    }
                    else if (highScoreData.moveChallengeLevels[level].rank == 1)
                    {
                        congratulationsMessage = "Try to score " + Game.currentSettings.two_star + " points to earn two \nstars!";
                    }
                    else
                    {
                        congratulationsMessage = "BUG!";
                    }
                    for (int i = 4; i >= 0; i--)
                    {
                        if (score >= levelData.highScores[i])
                        {
                            if (i < 4)
                            {
                                levelData.highScores[i + 1]  = levelData.highScores[i];
                                levelData.playerNames[i + 1] = levelData.playerNames[i];
                            }
                            initials = levelData.playerNames[i];
                            rank     = i;
                            levelData.highScores[i] = score;
                        }
                    }
                    if (score >= Game.currentSettings.two_star && level < highScoreData.moveChallengeLevels.Count() - 1)
                    {
                        if (highScoreData.moveChallengeLevels[level + 1] != null)
                        {
                            highScoreData.moveChallengeLevels[level + 1].unlocked = true;
                        }
                    }
                }
                else if (Game.currentSettings.mode == GameMode.Puzzle)
                {
                    levelData = highScoreData.puzzleLevels[level];
                    highScoreData.puzzleLevels[level].played = true;
                    TimeSpan twoStarTime   = new TimeSpan(0, 0, 0, 0, Game.currentSettings.two_star);
                    TimeSpan threeStarTime = new TimeSpan(0, 0, 0, 0, Game.currentSettings.three_star);
                    if (highScoreData.puzzleLevels[level].rank < 3 && score <= Game.currentSettings.three_star)
                    {
                        congratulationsMessage = "Outstanding job! This patient has made a full \nrecovery, giving you the top ranking! Way to go!";
                        highScoreData.puzzleLevels[level].rank = 3;
                    }
                    else if (highScoreData.puzzleLevels[level].rank < 2 && score <= Game.currentSettings.two_star)
                    {
                        congratulationsMessage = string.Format("Great job! You've earned two stars! Try to finish \nin under {0}:{1:D2} to make it to the next rank!", threeStarTime.Minutes, threeStarTime.Seconds);
                        highScoreData.puzzleLevels[level].rank = 2;
                    }
                    else if (highScoreData.puzzleLevels[level].rank == 0)
                    {
                        highScoreData.puzzleLevels[level].rank = 1;
                        congratulationsMessage = string.Format("Good job! You've earned one star! Try to finish \nin under {0}:{1:D2} to make it to the next rank!", twoStarTime.Minutes, twoStarTime.Seconds);
                    }
                    else if (highScoreData.puzzleLevels[level].rank == 3)
                    {
                        congratulationsMessage = "This patient has already made a full recovery! \nSee if you can beat your high score!";
                    }
                    else if (highScoreData.puzzleLevels[level].rank == 2)
                    {
                        congratulationsMessage = string.Format("Try to finish in under {0}:{1:D2} to earn three \nstars!", threeStarTime.Minutes, threeStarTime.Seconds);
                    }
                    else if (highScoreData.puzzleLevels[level].rank == 1)
                    {
                        congratulationsMessage = string.Format("Try to finish in under {0}:{1:D2} to earn two \nstars!", twoStarTime.Minutes, twoStarTime.Seconds);
                    }
                    else
                    {
                        congratulationsMessage = "BUG!";
                    }
                    for (int i = 4; i >= 0; i--)
                    {
                        if (score <= levelData.highScores[i])
                        {
                            if (i < 4)
                            {
                                levelData.highScores[i + 1]  = levelData.highScores[i];
                                levelData.playerNames[i + 1] = levelData.playerNames[i];
                            }
                            initials = levelData.playerNames[i];
                            rank     = i;
                            levelData.highScores[i] = score;
                        }
                    }

                    if (score <= Game.currentSettings.two_star && level < highScoreData.puzzleLevels.Count() - 1)
                    {
                        List <Settings> puzzleSettings = SettingsLoader.LoadPuzzleLevels();
                        if (Game.currentSettings.difficulty == Difficulty.EASY)
                        {
                            for (int i = 0; i < puzzleSettings.Count(); i++)
                            {
                                if (highScoreData.puzzleLevels[i] != null && (puzzleSettings[i].difficulty == Difficulty.MEDIUM || puzzleSettings[i].difficulty == Difficulty.EASY))
                                {
                                    highScoreData.puzzleLevels[i].unlocked = true;
                                }
                            }
                        }
                        if (Game.currentSettings.difficulty == Difficulty.MEDIUM)
                        {
                            for (int i = 0; i < puzzleSettings.Count(); i++)
                            {
                                if (highScoreData.puzzleLevels[i] != null && puzzleSettings[i].difficulty == Difficulty.HARD)
                                {
                                    highScoreData.puzzleLevels[i].unlocked = true;
                                }
                            }
                        }
                    }
                }
                HighScoreTracker.SaveHighScores(highScoreData);
                state = GameOverMenuState.DOCTORIN;
            }
            if (state == GameOverMenuState.DOCTORIN || state == GameOverMenuState.DOCTOROUT || state == GameOverMenuState.ANIMATEDOWN || state == GameOverMenuState.ANIMATEUP)
            {
                animateTime += gameTime.ElapsedGameTime.Milliseconds;
            }
            if (state == GameOverMenuState.DOCTORIN && animateTime > 250)
            {
                MusicControl.PlayMenuMusic();
                state = GameOverMenuState.READY;
                if (rank != -1)
                {
                    state = GameOverMenuState.INITIALS;
                }
            }
            if (state == GameOverMenuState.DOCTOROUT && animateTime > 250)
            {
                animateTime = 0;
                state       = GameOverMenuState.DOCTORIN;
                return(result);
            }
            if (state == GameOverMenuState.ANIMATEDOWN && animateTime > 250)
            {
                animateTime = 0;
                state       = GameOverMenuState.READY;
            }
            if (state == GameOverMenuState.ANIMATEUP && animateTime > 250)
            {
                animateTime = 0;
                state       = GameOverMenuState.READY;
            }
            if (state == GameOverMenuState.INITIALS && cooldown == 0)
            {
                GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
                Vector2      leftStick    = gamePadState.ThumbSticks.Left;
                Vector2      rightStick   = gamePadState.ThumbSticks.Right;
                if (gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState().IsKeyDown(Keys.Down) || leftStick.Y < -Game.gameSettings.controlStickTrigger || rightStick.Y < -Game.gameSettings.controlStickTrigger)
                {
                    SoundEffects.PlayClick();
                    Char[] cArray = initials.ToCharArray();
                    Char   c      = cArray[currentCharacter];
                    c--;
                    if (c < 'A')
                    {
                        c = 'Z';
                    }
                    cArray[currentCharacter] = c;
                    initials = new String(cArray);
                    cooldown = 100;
                }
                if (gamePadState.IsButtonDown(Buttons.DPadUp) || gamePadState.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState().IsKeyDown(Keys.Up) || leftStick.Y > Game.gameSettings.controlStickTrigger || rightStick.Y > Game.gameSettings.controlStickTrigger)
                {
                    SoundEffects.PlayClick();
                    Char[] cArray = initials.ToCharArray();
                    Char   c      = cArray[currentCharacter];
                    c++;
                    if (c > 'Z')
                    {
                        c = 'A';
                    }
                    cArray[currentCharacter] = c;
                    initials = new String(cArray);
                    cooldown = 100;
                }
                if (gamePadState.IsButtonDown(Buttons.DPadRight) || gamePadState.IsButtonDown(Buttons.DPadRight) || Keyboard.GetState().IsKeyDown(Keys.Right) || gamePadState.IsButtonDown(Buttons.A))
                {
                    currentCharacter++;
                    cooldown = 250;
                    if (currentCharacter > 2)
                    {
                        SoundEffects.PlayScore();
                        cooldown = 500;
                        levelData.playerNames[rank] = initials;
                        HighScoreData data = HighScoreTracker.LoadHighScores();
                        levelData.played = true;
                        if (Game.currentSettings.mode == GameMode.TimeAttack)
                        {
                            data.timeAttackLevels[level] = levelData;
                        }
                        else if (Game.currentSettings.mode == GameMode.Puzzle)
                        {
                            data.puzzleLevels[level] = levelData;
                        }
                        else
                        {
                            data.moveChallengeLevels[level] = levelData;
                        }
                        HighScoreTracker.SaveHighScores(data);
                        state = GameOverMenuState.READY;
                    }
                    else
                    {
                        SoundEffects.PlayClick();
                    }
                }
                if (gamePadState.IsButtonDown(Buttons.DPadLeft) || gamePadState.IsButtonDown(Buttons.DPadLeft) || Keyboard.GetState().IsKeyDown(Keys.Left) || gamePadState.IsButtonDown(Buttons.B))
                {
                    SoundEffects.PlayClick();
                    if (currentCharacter > 0)
                    {
                        currentCharacter--;
                        cooldown = 250;
                    }
                }
            }
            if (state == GameOverMenuState.READY && cooldown == 0)
            {
                GamePadState gamePadState = GamePad.GetState(Game.playerIndex);
                Vector2      leftStick    = gamePadState.ThumbSticks.Left;
                Vector2      rightStick   = gamePadState.ThumbSticks.Right;

                if (Keyboard.GetState().IsKeyDown(Keys.Space) || gamePadState.IsButtonDown(Buttons.A) || gamePadState.IsButtonDown(Buttons.Start))
                {
                    result      = optionList[selectedIndex].result;
                    animateTime = 0;
                    state       = GameOverMenuState.DOCTOROUT;
                    SoundEffects.PlayScore();
                }
                if (gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || gamePadState.IsButtonDown(Buttons.DPadDown) || Keyboard.GetState().IsKeyDown(Keys.Down) || leftStick.Y < -Game.gameSettings.controlStickTrigger || rightStick.Y < -Game.gameSettings.controlStickTrigger)
                {
                    if (selectedIndex < optionList.Count() - 1)
                    {
                        state       = GameOverMenuState.ANIMATEDOWN;
                        animateTime = 0;
                        selectedIndex++;
                        cooldown = 250;
                        SoundEffects.PlayMove();
                    }
                }
                if (gamePadState.IsButtonDown(Buttons.DPadUp) || gamePadState.IsButtonDown(Buttons.DPadUp) || Keyboard.GetState().IsKeyDown(Keys.Up) || leftStick.Y > Game.gameSettings.controlStickTrigger || rightStick.Y > Game.gameSettings.controlStickTrigger)
                {
                    if (selectedIndex > 0)
                    {
                        state       = GameOverMenuState.ANIMATEUP;
                        animateTime = 0;

                        selectedIndex--;
                        cooldown = 250;
                        SoundEffects.PlayMove();
                    }
                }
            }
            return(MenuResult.None);
        }