/// <summary>
        /// Constructor.
        /// </summary>
        public LevelSelectScreen()
            : base("Level Select")
        {
            // get save data
            saveGameData = new GameData();

            // Create our menu entries.
            level1MenuEntry = new VarSizeMenuEntry ( "1 - "+GameConstants.LEVELNAMES[0], 0.9f );
            level2MenuEntry = new VarSizeMenuEntry ( "2 - "+GameConstants.LEVELNAMES[1], 0.9f );
            level3MenuEntry = new VarSizeMenuEntry ( "3 - " + GameConstants.LEVELNAMES[2], 0.9f );
            level4MenuEntry = new VarSizeMenuEntry ( "4 - " + GameConstants.LEVELNAMES[3], 0.9f );
            level5MenuEntry = new VarSizeMenuEntry ( "5 - " + GameConstants.LEVELNAMES[4], 0.9f );
            level6MenuEntry = new VarSizeMenuEntry ( "6 - " + GameConstants.LEVELNAMES[5], 0.9f );

            MenuEntry back = new VarSizeMenuEntry ( "Back to Main Menu", 0.9f );

            // Hook up menu event handlers.
            level1MenuEntry.Selected += level1MenuEntrySelected;
            level2MenuEntry.Selected += level2MenuEntrySelected;
            level3MenuEntry.Selected += level3MenuEntrySelected;
            level4MenuEntry.Selected += level4MenuEntrySelected;
            level5MenuEntry.Selected += level5MenuEntrySelected;
            level6MenuEntry.Selected += level6MenuEntrySelected;
            back.Selected += OnCancel;

            // Add entries to the menu.

            MenuEntries.Add(level1MenuEntry);
            MenuEntries.Add(level2MenuEntry);
            MenuEntries.Add(level3MenuEntry);
            MenuEntries.Add(level4MenuEntry);
            MenuEntries.Add ( level5MenuEntry );
            MenuEntries.Add ( level6MenuEntry );
            MenuEntries.Add(back);
        }
예제 #2
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
            : base("Main Menu")
        {
            // get save game
            saveGameData = new GameData();

            // Create our menu entries.

            if (saveGameData.saveGameData.currentlevel < GameConstants.LEVELS &&
                saveGameData.saveGameData.currentlevel > 1)
                playGameMenuEntry = new MenuEntry("Continue Game");
            else if(saveGameData.saveGameData.currentlevel == 1)
                playGameMenuEntry = new MenuEntry("Play Game");
            MenuEntry LevelSelectMenuEntry = new MenuEntry("Level Select");
            MenuEntry optionsMenuEntry = new MenuEntry("Options");
            MenuEntry exitMenuEntry = new MenuEntry("Exit");

            // Hook up menu event handlers.
            playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
            LevelSelectMenuEntry.Selected += LevelSelectMenuEntrySelected;
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            exitMenuEntry.Selected += OnCancel;

            // Add entries to the menu.
            MenuEntries.Add(playGameMenuEntry);
            MenuEntries.Add(LevelSelectMenuEntry);
            MenuEntries.Add(optionsMenuEntry);
            MenuEntries.Add(exitMenuEntry);
        }
예제 #3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public StoryScreen( List<String> storytext, List<String> titletext, GameScreen DestScreen, GameData saveData)
            : base(titletext[0])
        {
            saveGameData = saveData;
            this.DestScreen = DestScreen;

            //SpriteFont font = ScreenManager.Font; //Get font of the ScreenManager
            // Create our menu entries.
            Storyline = storytext;
            StoryTitles = titletext;

            StorylineEntry = new VarSizeMenuEntry ( Storyline[0] , 0.7f);
            BlankEntry = new VarSizeMenuEntry ( " ", 0.7f);
            MenuEntry ContinueEntry = new VarSizeMenuEntry ( "Continue", 1f);

            // Hook up menu event handlers.
            ContinueEntry.Selected += continueSelected;

            // Add entries to the menu.
            MenuEntries.Add ( StorylineEntry );
            MenuEntries.Add ( BlankEntry );
            MenuEntries.Add ( ContinueEntry );

            //Select the first selectable entry
            while (menuEntries[selectedEntry].HasNoHandle)
            {
                selectedEntry++;
            }
        }
예제 #4
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public NextLevelScreen(GameData.LevelData levelData )
            : base("Next Level")
        {
            this.levelData = levelData;
            // Create our menu entries.

            levelNumEntry = new MenuEntry("Level "+(levelData.currentlevelNum+1)+":");
            currentLevelEntry = new MenuEntry("\""+GameConstants.LEVELNAMES[levelData.currentlevelNum]+"\"");
            //timeCompleteEntry = new MenuEntry(time);
            blankEntry = new MenuEntry ( "" );
            nextLevelEntry = new MenuEntry ( "Start" );
            scoreScreenEntry = new MenuEntry ( "Score Screen" );
            mainMenuEntry = new MenuEntry ( "Main Menu" );

            // Hook up menu event handlers.
            mainMenuEntry.Selected += mainMenuEntrySelected;
            scoreScreenEntry.Selected += scoreScreenEntrySelected;
            nextLevelEntry.Selected += nextLevelEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add ( levelNumEntry );
            MenuEntries.Add(currentLevelEntry);
            MenuEntries.Add ( blankEntry );
            MenuEntries.Add ( blankEntry );

            // check to see if there are still levels left before adding nextLevelEntry
            if (levelData.currentlevelNum < GameConstants.LEVELS)
            {
                MenuEntries.Add(nextLevelEntry);
            }
            // load credits
            else if (levelData.currentlevelNum == GameConstants.LEVELS)
            {
                // load game complete screen with credits if all levels are finished
                //LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
                //               new GameCompleteScreen());
            }

            MenuEntries.Add ( scoreScreenEntry );
            MenuEntries.Add(mainMenuEntry);

            //Select the first selectable entry
            while (menuEntries[selectedEntry].HasNoHandle) {
                selectedEntry++;
            }
        }
예제 #5
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameOverScreen(GameData.LevelData levelData )
            : base("Game Over")
        {
            // Create our menu entries.
            retryLevelEntry = new MenuEntry("Retry Level");
            mainMenuEntry = new MenuEntry("Main Menu");

            // Hook up menu event handlers.
            mainMenuEntry.Selected += mainMenuEntrySelected;
            retryLevelEntry.Selected += retryLevelEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(retryLevelEntry);
            MenuEntries.Add(mainMenuEntry);

            this.levelData = levelData;
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public LevelCompleteScreen(GameData.LevelData levelData )
            : base("Level Complete")
        {
            this.levelData = levelData;
            gameData = new GameData();
            if (gameData.saveGameData.levelCompleted < levelData.currentlevelNum)
                gameData.saveGameData.levelCompleted = levelData.currentlevelNum;
            gameData.saveGameData.levelData[levelData.currentlevelNum-1].time = levelData.time.ToString();

            int levelScore = 0;
            levelScore += (int)GameConstants.SCORE.levelComplete; // add score for completing level
            // Score for health
            if(levelData.remainingHealth == GameConstants.HEALTH)
            {
                levelScore += (int)GameConstants.SCORE.fullHealth;
            }
            if (levelData.remainingHealth == GameConstants.HEALTH-1)
            {
                levelScore += (int)GameConstants.SCORE.medHealth;
            }
            if (levelData.remainingHealth == GameConstants.HEALTH-2)
            {
                levelScore += (int)GameConstants.SCORE.lowHealth;
            }

            //if(new TimeSpan( levelData.time < levelData.levelParTime)
            //{
            //    score += GameConstants.SCORE.parTimeComplete;
            //}

            gameData.saveGameData.score += levelScore;
            if(gameData.saveGameData.levelData[levelData.currentlevelNum - 1].levelHighScore < levelScore)
                gameData.saveGameData.levelData[levelData.currentlevelNum - 1].levelHighScore = levelScore;
            gameData.GetContainer();
            gameData.Save();

            // Create our menu entries.
            string time = string.Format("Time Completed: {0}", levelData.time);
            time = time.Remove(time.Length - 8);

            currentLevelEntry = new MenuEntry("\""+GameConstants.LEVELNAMES[levelData.currentlevelNum-1]+"\"");
            //timeCompleteEntry = new MenuEntry(time);
            remaingingHealthEntry = new MenuEntry("Remaining Health: " + levelData.remainingHealth.ToString());
            levelScoreEntry = new MenuEntry("Level Score: " + levelScore);
            highScoreEntry = new MenuEntry("Game Score: " + gameData.saveGameData.score.ToString());
            blankEntry = new MenuEntry ( "" );
            continueEntry = new MenuEntry("Continue");
            mainMenuEntry = new MenuEntry ( "Back to Main Menu" );

            // Hook up menu event handlers.
            mainMenuEntry.Selected += mainMenuEntrySelected;
            continueEntry.Selected += continueEntrySelected;

            // Add entries to the menu.
            MenuEntries.Add(currentLevelEntry);
            //MenuEntries.Add(timeCompleteEntry);
            MenuEntries.Add(remaingingHealthEntry);
            MenuEntries.Add(levelScoreEntry);
            MenuEntries.Add ( highScoreEntry );
            MenuEntries.Add ( blankEntry );

            // check to see if there are still levels left before adding nextLevelEntry
            if (levelData.currentlevelNum < GameConstants.LEVELS)
            {
                MenuEntries.Add(continueEntry);
            }
            // load credits
            else if (levelData.currentlevelNum == GameConstants.LEVELS)
            {
                // load game complete screen with credits if all levels are finished
                //LoadingScreen.Load(ScreenManager, true, e.PlayerIndex,
                //               new GameCompleteScreen());
            }

            MenuEntries.Add(mainMenuEntry);

            //Select the first selectable entry
            while (menuEntries[selectedEntry].HasNoHandle) {
                selectedEntry++;
            }
        }
예제 #7
0
        protected override void LoadContent()
        {
            // On Windows and Xbox we just add the initial screens
            AddInitialScreens();

            // load save game data
            saveGameData = new GameData();
        }