Ejemplo n.º 1
0
 void RetryDevice(IAsyncResult result)
 {
     try
     {
         HighScoreTracker.device = StorageDevice.EndShowSelector(result);
     }
     catch
     {
         HighScoreTracker.device = null;
     }
     if (HighScoreTracker.device == null)
     {
         try
         {
             while (Guide.IsVisible == true)
             {
                 System.Threading.Thread.Sleep(500);
             }
             if (Guide.IsVisible == false)
             {
                 Guide.BeginShowMessageBox("No Storage Device Selected",
                                           "You will be unable to save your game progress or high scores.",
                                           new string[] { "OK" },
                                           0, MessageBoxIcon.None, NoStorageCallback, null);
             }
         }
         catch
         {
         }
     }
     else
     {
         deviceSelected = true;
         HighScoreData data = HighScoreTracker.LoadHighScores();
     }
 }
Ejemplo n.º 2
0
        public void Draw()
        {
            if (highScoreData == null)
            {
                highScoreData = HighScoreTracker.LoadHighScores();
            }
            for (int i = 0; i < levelList.Count; i++)
            {
                int t = (i - currentLevel) * 100;
                if (state == SelectMenuState.SWAPRIGHT)
                {
                    t += 100;
                    t -= animateTime * 100 / swapTime;
                }
                if (state == SelectMenuState.SWAPLEFT)
                {
                    t -= 100;
                    t += animateTime * 100 / swapTime;
                }
                int   x     = t * 3;
                int   y     = -t * t / 100;
                float scale = Math.Max(0, .50f - (t * t) / 50000f);
                if (state == SelectMenuState.SELECTING)
                {
                    if (i != currentLevel)
                    {
                        scale = Math.Max(0, .50f - (t * t) / 50000f) * (1f - animateTime / 1000f);
                    }
                    else
                    {
                        scale = .5f + .5f * (animateTime / 1000f);
                        y     = (int)(100f * (animateTime / 1000f));
                    }
                }

                LevelData levelData = GetLevelData(i);
                if (levelData.unlocked && !(Guide.IsTrialMode && levelList[i].fullVersionOnly))
                {
                    JellyfishRenderer.DrawJellyfish(x + selectedJellyX, selectedJellyY + y, 100, levelList[i].texture, scale);
                }
                else
                {
                    JellyfishRenderer.DrawJellyfish(x + selectedJellyX, selectedJellyY + y, 100, JellyfishRenderer.mysteryJelly, scale);
                }
            }
            if (state == SelectMenuState.DOCTORIN)
            {
                JellyfishRenderer.DrawJellyfish(doctorX - docShift + (int)(docShift * animateTime / 500f), doctorY, 100, JellyfishRenderer.doctorJellyfish, 1f);
                JellyfishRenderer.DrawJellyfish(nurseX + docShift - (int)(docShift * animateTime / 500f), nurseY, 100, JellyfishRenderer.nurseJellyfish, 1f);
            }
            if (state == SelectMenuState.TEXT)
            {
                JellyfishRenderer.DrawJellyfish(doctorX, doctorY, 100, JellyfishRenderer.doctorJellyfish, 1f);
                JellyfishRenderer.DrawJellyfish(nurseX, nurseY, 100, JellyfishRenderer.nurseJellyfish, 1f);
            }
            if (state == SelectMenuState.DOCTOROUT)
            {
                JellyfishRenderer.DrawJellyfish(doctorX - (int)(docShift * animateTime / 500f), doctorY, 100, JellyfishRenderer.doctorJellyfish, 1f);
                JellyfishRenderer.DrawJellyfish(nurseX + (int)(docShift * animateTime / 500f), nurseY, 100, JellyfishRenderer.nurseJellyfish, 1f);
            }
            if (state == SelectMenuState.READY || state == SelectMenuState.SWAPLEFT || state == SelectMenuState.SWAPRIGHT)
            {
                Game.spriteBatch.DrawString(Game.spriteFont, levelList[currentLevel].name, new Vector2(nameX + 50, nameY), Color.LightGreen);
                if (currentLevel > 0)
                {
                    Game.spriteBatch.DrawString(Game.spriteFont, "<", new Vector2(nameX, nameY), Color.LightGreen);
                }
                if (currentLevel < levelList.Count - 1)
                {
                    Game.spriteBatch.DrawString(Game.spriteFont, ">", new Vector2(nameX + 250, nameY), Color.LightGreen);
                }

                // Draw stars
                LevelData levelData    = GetLevelData(currentLevel);
                int       ratingOffset = 0;
                if (levelList[currentLevel].mode == GameMode.Puzzle)
                {
                    ratingOffset = previewOffset;
                }
                for (int i = 0; i < 3; i++)
                {
                    Game.spriteBatch.Draw(emptyStar,
                                          new Rectangle(ratingX + 75 * i - ratingOffset, ratingY + 40, 64, 64), Color.White);
                }
                if (levelData.played == true)
                {
                    Game.spriteBatch.Draw(star,
                                          new Rectangle(ratingX - ratingOffset, ratingY + 40, 64, 64), Color.White);
                    if (levelData.rank >= 2)
                    {
                        Game.spriteBatch.Draw(star,
                                              new Rectangle(ratingX + 75 - ratingOffset, ratingY + 40, 64, 64), Color.White);
                    }
                    if (levelData.rank >= 3)
                    {
                        Game.spriteBatch.Draw(star,
                                              new Rectangle(ratingX + 150 - ratingOffset, ratingY + 40, 64, 64), Color.White);
                    }
                }
                if (levelList[currentLevel].mode == GameMode.TimeAttack)
                {
                    String difficultyString = "BUG";
                    if (levelList[currentLevel].difficulty == Difficulty.EASY)
                    {
                        difficultyString = "Beginner";
                    }
                    if (levelList[currentLevel].difficulty == Difficulty.MEDIUM)
                    {
                        difficultyString = "Standard";
                    }
                    if (levelList[currentLevel].difficulty == Difficulty.HARD)
                    {
                        difficultyString = "Advanced";
                    }
                    Game.spriteBatch.DrawString(Game.spriteFont, "Difficulty: " + difficultyString, new Vector2(highScoreX - 20, highScoreY), Color.LightGreen);

                    Game.spriteBatch.DrawString(Game.spriteFont, "High Scores", new Vector2(highScoreX, highScoreY + 30), Color.LightGreen);

                    levelData = highScoreData.timeAttackLevels[currentLevel];
                    for (int i = 1; i < 6; i++)
                    {
                        Game.spriteBatch.DrawString(Game.spriteFont, i + ": " + levelData.playerNames[i - 1] + " - " + levelData.highScores[i - 1], new Vector2(highScoreX, highScoreY + highScoreLine * i + 35), Color.LightGreen);
                    }
                }
                else if (levelList[currentLevel].mode == GameMode.MoveChallenge)
                {
                    String difficultyString = "BUG";
                    if (levelList[currentLevel].difficulty == Difficulty.EASY)
                    {
                        difficultyString = "Beginner";
                    }
                    if (levelList[currentLevel].difficulty == Difficulty.MEDIUM)
                    {
                        difficultyString = "Standard";
                    }
                    if (levelList[currentLevel].difficulty == Difficulty.HARD)
                    {
                        difficultyString = "Advanced";
                    }
                    Game.spriteBatch.DrawString(Game.spriteFont, "Difficulty: " + difficultyString, new Vector2(highScoreX - 20, highScoreY), Color.LightGreen);

                    Game.spriteBatch.DrawString(Game.spriteFont, "High Scores", new Vector2(highScoreX, highScoreY + 30), Color.LightGreen);
                    if (highScoreData == null)
                    {
                        highScoreData = HighScoreTracker.LoadHighScores();
                    }
                    for (int i = 1; i < 6; i++)
                    {
                        Game.spriteBatch.DrawString(Game.spriteFont, i + ": " + levelData.playerNames[i - 1] + " - " + levelData.highScores[i - 1], new Vector2(highScoreX, highScoreY + highScoreLine * i + 35), Color.LightGreen);
                    }
                }
                else
                {
                    String difficultyString = "BUG";
                    if (levelList[currentLevel].difficulty == Difficulty.EASY)
                    {
                        difficultyString = "Beginner";
                    }
                    if (levelList[currentLevel].difficulty == Difficulty.MEDIUM)
                    {
                        difficultyString = "Standard";
                    }
                    if (levelList[currentLevel].difficulty == Difficulty.HARD)
                    {
                        difficultyString = "Advanced";
                    }
                    Game.spriteBatch.DrawString(Game.spriteFont, "Difficulty: " + difficultyString, new Vector2(highScoreX - 20 - previewOffset, highScoreY), Color.LightGreen);
                    Game.spriteBatch.DrawString(Game.spriteFont, "High Scores", new Vector2(highScoreX - previewOffset, highScoreY + 30), Color.LightGreen);
                    if (highScoreData == null)
                    {
                        highScoreData = HighScoreTracker.LoadHighScores();
                    }
                    for (int i = 1; i < 6; i++)
                    {
                        TimeSpan t = new TimeSpan(0, 0, 0, 0, levelData.highScores[i - 1]);
                        Game.spriteBatch.DrawString(Game.spriteFont, string.Format("{0}:{1} - {2}:{3:D2}", i, levelData.playerNames[i - 1], t.Minutes, t.Seconds), new Vector2(highScoreX - previewOffset, highScoreY + highScoreLine * i + 35), Color.LightGreen);
                    }
                    Game.spriteBatch.Draw(levelList[currentLevel].preview, new Rectangle(previewX, previewY, 625 / 2, 469 / 2), Color.White);
                }
            }
            if (state == SelectMenuState.TEXT)
            {
                LevelData levelData = GetLevelData(currentLevel);

                if (levelData.unlocked && !(Guide.IsTrialMode && levelList[currentLevel].fullVersionOnly))
                {
                    if (textPieces[currentTextPiece].Split(':')[0] == "D")
                    {
                        JellyfishRenderer.DrawSpeechBubble(speechX, speechY, 100, SpriteEffects.None);
                    }
                    else
                    {
                        JellyfishRenderer.DrawSpeechBubble(speechX, speechY, 100, SpriteEffects.FlipHorizontally);
                    }
                    String text = textPieces[currentTextPiece].Split(':')[1];
                    Game.spriteBatch.DrawString(Game.spriteFont, text, new Vector2(speechX - 250, speechY), Color.Black);
                }
                else if (Guide.IsTrialMode && levelList[currentLevel].fullVersionOnly)
                {
                    JellyfishRenderer.DrawSpeechBubble(speechX, speechY, 100, SpriteEffects.None);
                    Game.spriteBatch.DrawString(Game.spriteFont, "This patient is only available on the full version\nof Jellyfish, MD. Go to the main menu to unlock it!", new Vector2(speechX - 250, speechY), Color.Black);
                }
                else
                {
                    JellyfishRenderer.DrawSpeechBubble(speechX, speechY, 100, SpriteEffects.None);
                    if (levelList[currentLevel].mode == GameMode.Puzzle)
                    {
                        if (levelList[currentLevel].difficulty == Difficulty.MEDIUM)
                        {
                            Game.spriteBatch.DrawString(Game.spriteFont, "Earn two stars on any Beginner puzzle \nto unlock this patient!", new Vector2(speechX - 250, speechY), Color.Black);
                        }
                        else if (levelList[currentLevel].difficulty == Difficulty.HARD)
                        {
                            Game.spriteBatch.DrawString(Game.spriteFont, "Earn two stars on any Standard puzzle \nto unlock this patient!", new Vector2(speechX - 250, speechY), Color.Black);
                        }
                    }
                    else
                    {
                        Game.spriteBatch.DrawString(Game.spriteFont, "Earn two stars on the previous jellyfish \nto unlock this patient!", new Vector2(speechX - 250, speechY), Color.Black);
                    }
                }
            }
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
 public MenuResult Update(GameTime gameTime)
 {
     cooldown -= gameTime.ElapsedGameTime.Milliseconds;
     r         = new Random();
     if (cooldown < 0)
     {
         cooldown = 0;
     }
     if (state == JellyfishCityState.SPAWN)
     {
         HighScoreData data = HighScoreTracker.LoadHighScores();
         jellyList = new List <Jellyfish>();
         // Load TimeAttack Jellies
         List <Settings> timeAttackSettingsList = SettingsLoader.LoadTimeAttackLevels();
         for (int i = 0; i < timeAttackSettingsList.Count; i++)
         {
             totalJellies++;
             if (data.timeAttackLevels[i].rank == 3)
             {
                 jelliesSaved++;
                 jellyList.Add(new Jellyfish(timeAttackSettingsList[i].texture));
             }
         }
         // Load MoveChallenge Jellies
         List <Settings> moveChallengeSettingsList = SettingsLoader.LoadMoveCountLevels();
         for (int i = 0; i < moveChallengeSettingsList.Count; i++)
         {
             totalJellies++;
             if (data.moveChallengeLevels[i].rank == 3)
             {
                 jelliesSaved++;
                 jellyList.Add(new Jellyfish(moveChallengeSettingsList[i].texture));
             }
         }
         // Load Puzzle Jellies
         List <Settings> puzzleSettingsList = SettingsLoader.LoadPuzzleLevels();
         for (int i = 0; i < puzzleSettingsList.Count; i++)
         {
             totalJellies++;
             if (data.puzzleLevels[i].rank == 3)
             {
                 jelliesSaved++;
                 jellyList.Add(new Jellyfish(puzzleSettingsList[i].texture));
             }
         }
         if (totalJellies == jelliesSaved)
         {
             jellyList.Add(new Jellyfish(JellyfishRenderer.doctorJellyfish));
         }
         state = JellyfishCityState.NURSEIN;
     }
     if (state == JellyfishCityState.NURSEIN || state == JellyfishCityState.NURSEOUT)
     {
         animateTime += gameTime.ElapsedGameTime.Milliseconds;
     }
     if (state == JellyfishCityState.NURSEIN && animateTime > 250)
     {
         if (intro)
         {
             state = JellyfishCityState.HELLO;
         }
         else
         {
             state = JellyfishCityState.GOODBYE;
         }
     }
     if (state == JellyfishCityState.NURSEOUT && animateTime > 250)
     {
         if (intro)
         {
             intro       = false;
             animateTime = 0;
             state       = JellyfishCityState.VIEW;
         }
         else
         {
             return(MenuResult.GoToMainMenu);
         }
     }
     if (state == JellyfishCityState.HELLO)
     {
         if (Keyboard.GetState().IsKeyDown(Keys.Space) || GamePad.GetState(Game.playerIndex).IsButtonDown(Buttons.A))
         {
             if (jelliesSaved == 0)
             {
                 intro = false;
                 state = JellyfishCityState.GOODBYE;
             }
             else
             {
                 state = JellyfishCityState.NURSEOUT;
             }
             animateTime = 0;
         }
     }
     if (state == JellyfishCityState.GOODBYE)
     {
         if (Keyboard.GetState().IsKeyDown(Keys.Space) || GamePad.GetState(Game.playerIndex).IsButtonDown(Buttons.A))
         {
             state       = JellyfishCityState.NURSEOUT;
             animateTime = 0;
         }
     }
     if (state == JellyfishCityState.VIEW)
     {
         if (Keyboard.GetState().IsKeyDown(Keys.Space) || GamePad.GetState(Game.playerIndex).IsButtonDown(Buttons.A))
         {
             state       = JellyfishCityState.NURSEIN;
             animateTime = 0;
         }
     }
     if (state != JellyfishCityState.SPAWN)
     {
         foreach (Jellyfish j in jellyList)
         {
             j.Update(gameTime);
         }
     }
     return(MenuResult.None);
 }
Ejemplo n.º 5
0
        protected override void Update(GameTime gameTime)
        {
            if (metaState == MetaState.InitialLoad)
            {
                splashScreen = new SplashScreen();
                metaState    = MetaState.SplashScreen;
            }

            // Controls
            //if (GamePad.GetState(Game.playerIndex).Buttons.Back == ButtonState.Pressed)
            //  this.Exit();
            if (HighScoreTracker.device != null && Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                HighScoreData data = HighScoreTracker.LoadHighScores();
                data.soundEffectsEnabled = gameSettings.soundEffectsEnabled;
                data.musicEnabled        = gameSettings.musicEnabled;
                data.displayHelp         = gameSettings.displayControls;
                data.wideScreen          = gameSettings.wideScreen;
                data.keyboardControls    = gameSettings.keyboardControls;
                HighScoreTracker.SaveHighScores(data);
                Logger.CloseLogger();
                this.Exit();
            }
            if (metaState == MetaState.SplashScreen)
            {
                if (MenuResult.GoToMainMenu == splashScreen.Update(gameTime))
                {
                    base.Initialize();
                    try
                    {
                        if (Guide.IsVisible == true)
                        {
                            splashScreen.stillActive = true;
                        }
                        else
                        {
                            StorageDevice.BeginShowSelector(this.GetDevice, "Select Storage Device");
                        }
                    }
                    catch
                    {
                        splashScreen.stillActive = true;
                    }
                }
            }
            if (HighScoreTracker.device != null && HighScoreTracker.device.IsConnected == true)
            {
                showRetry = false;
            }
            if (backToRetry == true || (HighScoreTracker.device != null && showRetry == false && HighScoreTracker.device.IsConnected == false))
            {
                if (Guide.IsVisible == false)
                {
                    try
                    {
                        StorageDevice.BeginShowSelector(this.RetryDevice, "Select Storage Device");
                        backToRetry = false;
                        showRetry   = true;
                    }
                    catch
                    {
                    }
                }
            }
            if (metaState == MetaState.SplashScreen && deviceSelected == true)
            {
                HighScoreData data = HighScoreTracker.LoadHighScores();
                gameSettings = new GameSettings();
                gameSettings.displayControls     = data.displayHelp;
                gameSettings.musicEnabled        = data.musicEnabled;
                gameSettings.soundEffectsEnabled = data.soundEffectsEnabled;
                gameSettings.fullScreen          = data.fullScreen;
                gameSettings.wideScreen          = data.wideScreen;
                gameSettings.keyboardControls    = data.keyboardControls;
                currentSettings  = new Settings();
                p1engine         = new Engine(-1);
                mainMenu         = new MainMenu();
                pauseMenu        = new PauseMenu();
                summaryMenu      = new SummaryMenu(false);
                gameOverMenu     = new GameOverMenu();
                selectMenu       = new LevelSelectMenu();
                tutorialLauncher = new TutorialLauncher();
                settingsMenu     = new Menu(MenuClass.SettingsMenu);

                currentSettings  = new Settings();
                p1engine         = new Engine(-1);
                mainMenu         = new MainMenu();
                pauseMenu        = new PauseMenu();
                summaryMenu      = new SummaryMenu(false);
                gameOverMenu     = new GameOverMenu();
                selectMenu       = new LevelSelectMenu();
                tutorialLauncher = new TutorialLauncher();
                settingsMenu     = new Menu(MenuClass.SettingsMenu);

                if (Guide.IsTrialMode)
                {
                    mainMenu.AddMenuItem(MenuResult.GoToTutorial, "Tutorial", "Learn to play Jellyfish, MD");
                }
                mainMenu.AddMenuItem(MenuResult.GoToTimeAttack, "Emergency Room", "Score as many points as you can within the \ntime limit.");
                mainMenu.AddMenuItem(MenuResult.GoToMoveChallenge, "Operation", "Score as many points as you can with a \nlimited number of moves.");
                mainMenu.AddMenuItem(MenuResult.GoToPuzzle, "Challenge", "Solve a series of unique challenges.");
                if (Guide.IsTrialMode == false)
                {
                    mainMenu.AddMenuItem(MenuResult.GoToTutorial, "Tutorial", "Learn to play Jellyfish, MD");
                }
                mainMenu.AddMenuItem(MenuResult.BuyFullGame, "Unlock Full Game", "Purchase the full version of Jellyfish, MD");
                mainMenu.AddMenuItem(MenuResult.GoToJellyfishCity, "Jellyfish Parade", "Check in on your former patients!");
                mainMenu.AddMenuItem(MenuResult.GoToSettings, "Settings", "Change settings for Jellyfish, MD");
                mainMenu.AddMenuItem(MenuResult.Quit, "Quit", "Quit Jellyfish, MD??");
                gameOverMenu.AddMenuItem(MenuResult.StartTimeAttack, "Replay");
                gameOverMenu.AddMenuItem(MenuResult.GoToMainMenu, "Main Menu");
                gameOverMenu.AddMenuItem(MenuResult.GoToLevelSelect, "Level Select");
                settingsMenu.AddMenuItem(MenuResult.GoToMainMenu, "Return to Menu");
                settingsMenu.AddMenuItem(MenuType.SoundToggle, "Sound Effects");
                settingsMenu.AddMenuItem(MenuType.MusicToggle, "Music");
                settingsMenu.AddMenuItem(MenuType.HelpToggle, "Help Overlay");

                #if WINDOWS
                settingsMenu.AddMenuItem(MenuType.FullScreenToggle, "Full Screen");
                settingsMenu.AddMenuItem(MenuType.WideScreenToggle, "Wide Screen");
                #endif
                UpdateResolution();

                metaState = MetaState.MainMenu;
            }
            if (metaState == MetaState.GamePlay && IsActive == true)
            {
                GameStopCause cause = p1engine.Update(gameTime);
                if (cause == GameStopCause.PAUSE)
                {
                    pauseMenu = new PauseMenu();
                    metaState = MetaState.Paused;
                }
                if (cause == GameStopCause.END)
                {
                    gameOverMenu.score = p1engine.currentScore;
                    gameOverMenu.level = currentSettings.level;
                    gameOverMenu.state = GameOverMenuState.SCORECHECK;
                    summaryMenu        = new SummaryMenu(true);
                    if (currentSettings.mode == GameMode.MoveChallenge)
                    {
                        summaryMenu.text = "Looks like you're out of moves, Doctor! \nLet's see how you did...";
                    }
                    if (currentSettings.mode == GameMode.TimeAttack)
                    {
                        summaryMenu.text = "Time's up, Doctor! Let's see \nhow you did...";
                    }
                    MusicControl.PlayMenuMusic();
                    metaState = MetaState.Summary;
                }
                if (cause == GameStopCause.WIN)
                {
                    gameOverMenu.score = Engine.clock.timeElapsed;
                    gameOverMenu.level = currentSettings.level;
                    gameOverMenu.state = GameOverMenuState.SCORECHECK;
                    summaryMenu        = new SummaryMenu(true);
                    summaryMenu.text   = "Way to go, Doctor! You did it!";
                    metaState          = MetaState.Summary;
                    MusicControl.PlayMenuMusic();
                }
                if (cause == GameStopCause.TUTORIAL_TEXT)
                {
                    TutorialStage.phase = TutorialPhase.Intro;
                    summaryMenu         = new SummaryMenu(true);
                    summaryMenu.text    = TutorialStage.IntroText();
                    if (summaryMenu.text == null)
                    {
                        metaState = MetaState.GamePlay;
                    }
                    summaryMenu.state = SummaryMenuState.READY;

                    metaState = MetaState.Summary;
                }
                if (cause == GameStopCause.TUTORIAL_PASS)
                {
                    TutorialStage.phase = TutorialPhase.Pass;
                    String text = TutorialStage.SuccessText();
                    summaryMenu      = new SummaryMenu(true);
                    summaryMenu.text = text;
                    metaState        = MetaState.Summary;
                }
                if (cause == GameStopCause.TUTORIAL_FAIL)
                {
                    TutorialStage.phase = TutorialPhase.Fail;
                    String text = TutorialStage.FailureText();
                    summaryMenu      = new SummaryMenu(false);
                    summaryMenu.text = text;
                    metaState        = MetaState.Summary;
                }
                if (cause == GameStopCause.LOSE_STUCK)
                {
                    summaryMenu        = new SummaryMenu(false);
                    summaryMenu.text   = "Oh no! Looks like you're stuck! Try to be more \ncareful next time!";
                    gameOverMenu.state = GameOverMenuState.READY;
                    metaState          = MetaState.Summary;
                }
                if (cause == GameStopCause.LOSE_ERROR)
                {
                    summaryMenu        = new SummaryMenu(false);
                    summaryMenu.text   = "Oh no! You burst a " + currentSettings.dangerColorDisplay + " bubble! Try to be more \ncareful next time!";
                    gameOverMenu.state = GameOverMenuState.READY;
                    metaState          = MetaState.Summary;
                }
            }
            else if (metaState == MetaState.Paused)
            {
                MenuResult result = pauseMenu.Update(gameTime);
                if (result == MenuResult.GoToMainMenu)
                {
                    TutorialStage.phase = TutorialPhase.None;
                    metaState           = MetaState.MainMenu;
                }
                if (result == MenuResult.ResumeGame)
                {
                    summaryMenu.state = SummaryMenuState.NURSEIN;
                    metaState         = MetaState.GamePlay;
                }
                if (result == MenuResult.GoToLevelSelect)
                {
                    MusicControl.PlayMenuMusic();
                    if (currentSettings.mode == GameMode.TimeAttack)
                    {
                        metaState = MetaState.Settings_TimeAttack;
                    }
                    if (currentSettings.mode == GameMode.Puzzle)
                    {
                        metaState = MetaState.Settings_Puzzle;
                    }
                    if (currentSettings.mode == GameMode.MoveChallenge)
                    {
                        metaState = MetaState.Settings_Move;
                    }
                }
                if (result == MenuResult.Replay)
                {
                    p1engine  = new Engine(-1);
                    metaState = MetaState.GamePlay;
                }
            }
            else if (metaState == MetaState.Summary)
            {
                if (Game.currentSettings.mode == GameMode.Puzzle && gameOverMenu.state != GameOverMenuState.SCORECHECK)
                {
                    Engine.clock.Update(gameTime);
                }
                MenuResult result = summaryMenu.Update(gameTime);
                if (TutorialStage.phase != TutorialPhase.None && TutorialStage.introIndex - 1 == TutorialStage.controlLessonIndex)
                {
                    p1engine.Update(gameTime);
                }
                if (result == MenuResult.GoToMainMenu)
                {
                    TutorialStage.phase = TutorialPhase.None;
                    metaState           = MetaState.MainMenu;
                }
                if (result == MenuResult.Replay)
                {
                    if (TutorialStage.phase == TutorialPhase.Fail)
                    {
                        p1engine.LoadTutorial(TutorialStage.lessonIndex);
                        TutorialStage.phase        = TutorialPhase.Intro;
                        TutorialStage.failureIndex = 0;
                        TutorialStage.introIndex   = 0;
                        TutorialStage.successIndex = 0;
                        p1engine.firstResume       = true;
                        metaState = MetaState.GamePlay;
                    }
                    else if (TutorialStage.phase == TutorialPhase.Pass)
                    {
                        p1engine.LoadTutorial(TutorialStage.lessonIndex);
                        TutorialStage.phase        = TutorialPhase.Intro;
                        TutorialStage.failureIndex = 0;
                        TutorialStage.introIndex   = 0;
                        TutorialStage.successIndex = 0;
                        p1engine.firstResume       = false;
                        metaState = MetaState.GamePlay;
                    }
                    else
                    {
                        p1engine = new Engine(-1);
                        MusicControl.PlayGameMusic();
                        metaState = MetaState.GamePlay;
                    }
                }
                if (result == MenuResult.Undo)
                {
                    p1engine.Back();
                    metaState = MetaState.GamePlay;
                }
                if (result == MenuResult.GoToResults)
                {
                    if (currentSettings.mode == GameMode.Tutorial)
                    {
                        if (TutorialStage.phase == TutorialPhase.Intro)
                        {
                            metaState = MetaState.GamePlay;
                        }
                        else if (TutorialStage.phase == TutorialPhase.Pass)
                        {
                            TutorialStage.lessonIndex++;
                            if (TutorialStage.lessonIndex == TutorialStage.maxLesson)
                            {
                                TutorialStage.phase = TutorialPhase.None;
                                summaryMenu         = new SummaryMenu(false);
                                metaState           = MetaState.MainMenu;
                            }
                            else
                            {
                                //p1engine = new Engine(TutorialStage.lessonIndex);
                                p1engine.LoadTutorial(TutorialStage.lessonIndex);
                                p1engine.firstResume = true;
                                //p1engine.gameState = State.VANISH;
                                TutorialStage.phase = TutorialPhase.Intro;
                                metaState           = MetaState.GamePlay;
                            }
                        }
                        else
                        {
                        }
                    }
                    else
                    {
                        metaState = MetaState.GameOver_TimeAttack;
                    }
                }
                if (result == MenuResult.GoToLevelSelect)
                {
                    MusicControl.PlayMenuMusic();
                    if (currentSettings.mode == GameMode.TimeAttack)
                    {
                        metaState = MetaState.Settings_TimeAttack;
                    }
                    if (currentSettings.mode == GameMode.Puzzle)
                    {
                        metaState = MetaState.Settings_Puzzle;
                    }
                    if (currentSettings.mode == GameMode.MoveChallenge)
                    {
                        metaState = MetaState.Settings_Move;
                    }
                }
            }
            else if (metaState == MetaState.Settings_TimeAttack || metaState == MetaState.Settings_Puzzle || metaState == MetaState.Settings_Move)
            {
                MenuResult result = selectMenu.Update(gameTime);
                if (result == MenuResult.GoToMainMenu)
                {
                    System.Threading.Thread.Sleep(100);
                    metaState = MetaState.MainMenu;
                }
                if (result == MenuResult.StartTimeAttack)
                {
                    currentSettings       = selectMenu.GetCurrentSettings();
                    currentSettings.level = selectMenu.currentLevel;
                    p1engine = new Engine(-1);
                    MusicControl.PlayGameMusic();
                    metaState = MetaState.GamePlay;
                }
            }
            else if (metaState == MetaState.GameOver_TimeAttack)
            {
                if (Engine.mode == ControlMode.AUTOMATED)
                {
                    p1engine  = new Engine(-1);
                    metaState = MetaState.GamePlay;
                }
                else
                {
                    MenuResult result = gameOverMenu.Update(gameTime);
                    if (result == MenuResult.GoToMainMenu)
                    {
                        metaState = MetaState.MainMenu;
                        System.Threading.Thread.Sleep(100);
                    }
                    if (result == MenuResult.GoToLevelSelect)
                    {
                        selectMenu       = new LevelSelectMenu();
                        selectMenu.state = LevelSelectMenu.SelectMenuState.LOAD;

                        if (currentSettings.mode == GameMode.MoveChallenge)
                        {
                            metaState               = MetaState.Settings_Move;
                            selectMenu.cooldown     = 250;
                            selectMenu.currentLevel = gameSettings.moveChallengeViewLevel;
                            selectMenu.levelList    = SettingsLoader.LoadMoveCountLevels();
                            currentSettings.mode    = GameMode.MoveChallenge;
                        }
                        if (currentSettings.mode == GameMode.TimeAttack)
                        {
                            metaState               = MetaState.Settings_TimeAttack;
                            selectMenu.cooldown     = 250;
                            selectMenu.currentLevel = gameSettings.timeAttackViewLevel;
                            selectMenu.levelList    = SettingsLoader.LoadTimeAttackLevels();
                            currentSettings.mode    = GameMode.TimeAttack;
                        }
                        if (currentSettings.mode == GameMode.Puzzle)
                        {
                            metaState               = MetaState.Settings_Puzzle;
                            selectMenu.cooldown     = 250;
                            selectMenu.levelList    = SettingsLoader.LoadPuzzleLevels();
                            selectMenu.currentLevel = gameSettings.puzzleViewLevel;
                            currentSettings.mode    = GameMode.Puzzle;
                        }
                    }
                    if (result == MenuResult.StartTimeAttack)
                    {
                        p1engine = new Engine(-1);
                        MusicControl.PlayGameMusic();
                        metaState = MetaState.GamePlay;
                    }
                }
            }
            else if (metaState == MetaState.Settings)
            {
                MenuResult result = settingsMenu.Update(gameTime);
                if (result == MenuResult.GoToMainMenu)
                {
                    metaState = MetaState.MainMenu;
                }
            }
            else if (metaState == MetaState.JellyfishCity)
            {
                MenuResult result = jellyCity.Update(gameTime);
                if (result == MenuResult.GoToMainMenu)
                {
                    metaState = MetaState.MainMenu;
                }
            }
            else if (metaState == MetaState.Tutorial)
            {
                MenuResult result = tutorialLauncher.Update(gameTime);
                if (result == MenuResult.StartTutorial)
                {
                    summaryMenu.state    = SummaryMenuState.READY;
                    currentSettings      = SettingsLoader.Tutorial();
                    p1engine             = new Engine(0);
                    p1engine.firstResume = true;
                    metaState            = MetaState.GamePlay;
                }
            }
            else if (metaState == MetaState.MainMenu)
            {
                MenuResult result = mainMenu.Update(gameTime);
                if (result == MenuResult.ReturnToSplashScreen)
                {
                    HighScoreData data = HighScoreTracker.LoadHighScores();
                    data.soundEffectsEnabled = gameSettings.soundEffectsEnabled;
                    data.musicEnabled        = gameSettings.musicEnabled;
                    data.displayHelp         = gameSettings.displayControls;
                    data.fullScreen          = gameSettings.fullScreen;
                    data.wideScreen          = gameSettings.wideScreen;
                    data.keyboardControls    = gameSettings.keyboardControls;
                    HighScoreTracker.SaveHighScores(data);

                    deviceSelected          = false;
                    HighScoreTracker.device = null;
                    if (HighScoreTracker.container != null)
                    {
                        HighScoreTracker.container.Dispose();
                    }
                    HighScoreTracker.container  = null;
                    HighScoreTracker.cachedData = null;
                    splashScreen = new SplashScreen();
                    metaState    = MetaState.SplashScreen;
                }
                if (result == MenuResult.BuyFullGame)
                {
                    try { Guide.ShowMarketplace(Game.playerIndex); }
                    catch (GamerPrivilegeException)
                    {
                        Guide.BeginShowMessageBox("Oops!",
                                                  "The current controller is either not signed in or is unable to purchase games on XBox Live.",
                                                  new string[] { "OK" },
                                                  0, MessageBoxIcon.None, null, null);
                    }
                    catch
                    {
                    }
                }
                if (result == MenuResult.GoToSettings)
                {
                    metaState = MetaState.Settings;
                }
                if (result == MenuResult.GoToTimeAttack)
                {
                    metaState               = MetaState.Settings_TimeAttack;
                    selectMenu              = new LevelSelectMenu();
                    selectMenu.levelList    = SettingsLoader.LoadTimeAttackLevels();
                    selectMenu.currentLevel = gameSettings.timeAttackViewLevel;
                    selectMenu.state        = LevelSelectMenu.SelectMenuState.LOAD;
                    currentSettings.mode    = GameMode.TimeAttack;
                    System.Threading.Thread.Sleep(100);
                }
                if (result == MenuResult.GoToPuzzle)
                {
                    metaState               = MetaState.Settings_Puzzle;
                    selectMenu              = new LevelSelectMenu();
                    selectMenu.levelList    = SettingsLoader.LoadPuzzleLevels();
                    selectMenu.state        = LevelSelectMenu.SelectMenuState.LOAD;
                    selectMenu.currentLevel = gameSettings.puzzleViewLevel;
                    currentSettings.mode    = GameMode.Puzzle;
                    System.Threading.Thread.Sleep(100);
                }
                if (result == MenuResult.GoToJellyfishCity)
                {
                    metaState = MetaState.JellyfishCity;
                    jellyCity = new JellyfishCity();
                }
                if (result == MenuResult.GoToTutorial)
                {
                    metaState                 = MetaState.Tutorial;
                    TutorialStage.phase       = TutorialPhase.Intro;
                    TutorialStage.lessonIndex = 0;
                    TutorialStage.loaded      = false;
                    tutorialLauncher          = new TutorialLauncher();
                }
                if (result == MenuResult.GoToMoveChallenge)
                {
                    metaState               = MetaState.Settings_Move;
                    selectMenu              = new LevelSelectMenu();
                    selectMenu.levelList    = SettingsLoader.LoadMoveCountLevels();
                    selectMenu.state        = LevelSelectMenu.SelectMenuState.LOAD;
                    selectMenu.currentLevel = gameSettings.moveChallengeViewLevel;
                    currentSettings.mode    = GameMode.TimeAttack;
                }
                if (result == MenuResult.StartCollect)
                {
                    p1engine  = new Engine(-1);
                    metaState = MetaState.GamePlay;
                }
                if (result == MenuResult.StartPuzzle)
                {
                    p1engine = new Engine(-1);

                    metaState = MetaState.GamePlay;
                }
                if (result == MenuResult.GoToSurvival)
                {
                    metaState = MetaState.GamePlay;
                }
                if (result == MenuResult.Quit)
                {
                    HighScoreData data = HighScoreTracker.LoadHighScores();
                    data.soundEffectsEnabled = gameSettings.soundEffectsEnabled;
                    data.musicEnabled        = gameSettings.musicEnabled;
                    data.displayHelp         = gameSettings.displayControls;
                    data.fullScreen          = gameSettings.fullScreen;
                    data.wideScreen          = gameSettings.wideScreen;
                    data.keyboardControls    = gameSettings.keyboardControls;
                    HighScoreTracker.SaveHighScores(data);
                    Logger.CloseLogger();
                    this.Exit();
                }
            }

            base.Update(gameTime);
        }
Ejemplo n.º 6
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);
        }