コード例 #1
0
        /// <summary>
        /// Load content the will be used to create the help screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              SpriteFont font = shared.Load<SpriteFont>("Font/menufont");

              detailsTemplate.Title = new TextLine("How To Play", font, new Color(192, 192, 192));

              exitMenuEntry = new MenuButton("Back", font);
              exitMenuEntry.Selected += OnCancel;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Middle] = exitMenuEntry;
              detailsTemplate.SelectedItem = DetailsTemplate.Selection.Middle;

              helpImage = shared.Load<Texture2D>("Texture/PuzzlePathScreenShot");
        }
コード例 #2
0
        /// <summary>
        /// Load content that will be used to create the help screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              SpriteFont titleFont = shared.Load<SpriteFont>("Font/menufont");

              detailsTemplate.Title = new TextLine("Controls", titleFont, new Color(192, 192, 192));

              IList<IMenuLine> controlScheme = detailsTemplate.Lines;
              controlScheme.Clear();

              foreach (string name in ControlScheme)
            controlScheme.Add(new TextLine(name, titleFont, Color.Black, .75f));

              exitMenuEntry = new MenuButton("Back", titleFont);
              exitMenuEntry.Selected += OnCancel;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Middle] = exitMenuEntry;
              detailsTemplate.SelectedItem = DetailsTemplate.Selection.Middle;
        }
コード例 #3
0
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              SpriteFont font = shared.Load<SpriteFont>("Font/menufont");

              content = shared;

              menuTemplate.Title = new TextLine("How To Play", font, new Color(192, 192, 192));

              // List that contains the menu buttons
              IList<MenuButton> items = menuTemplate.Items;

              // Create the Menu Buttons, attach what happens for each entry,
              // and add the menu buttons to the list of buttons.
              MenuButton gameDescriptionMenuEntry = new MenuButton("The Game's Objective", font);
              gameDescriptionMenuEntry.Selected += GameObjectiveMenuEntrySelected;
              items.Add(gameDescriptionMenuEntry);

              MenuButton controlsDescriptionMenuEntry = new MenuButton("Controls", font);
              controlsDescriptionMenuEntry.Selected += ControlsDescriptionMenuEntrySelected;
              items.Add(controlsDescriptionMenuEntry);

              MenuButton gameObjectsDescriptionMenuEntry = new MenuButton("Game Objects", font);
              gameObjectsDescriptionMenuEntry.Selected += GameObjectsDescriptionMenuEntrySelected;
              items.Add(gameObjectsDescriptionMenuEntry);

              MenuButton gameScreenShotMenuEntry = new MenuButton("Example", font);
              gameScreenShotMenuEntry.Selected += GameScreenShotMenuEntrySelected;
              items.Add(gameScreenShotMenuEntry);

              MenuButton levelEditorDescriptionMenuEntry = new MenuButton("Editing Levels", font);
              levelEditorDescriptionMenuEntry.Selected += LevelEditorDescriptionMenuEntrySelected;
              items.Add(levelEditorDescriptionMenuEntry);

              MenuButton exitMenuEntry = new MenuButton("Back", font);
              exitMenuEntry.Selected += OnCancel;
              items.Add(exitMenuEntry);
        }
コード例 #4
0
        /// <summary>
        /// Load content the will be used to create the help menu screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              SpriteFont font = shared.Load<SpriteFont>("Font/menufont");

              detailsTemplate.Title = new TextLine("Welcome to Puzzle Path", font, new Color(192, 192, 192));

              IList<IMenuLine> description = detailsTemplate.Lines;
              description.Clear();

              foreach (string name in gameDescription)
            description.Add(new TextLine(name, font, Color.Black, .75f));

              exitMenuEntry = new MenuButton("Back", font);
              exitMenuEntry.Selected += OnCancel;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Middle] = exitMenuEntry;
              detailsTemplate.SelectedItem = DetailsTemplate.Selection.Middle;
        }
コード例 #5
0
        /// <summary>
        /// Load the assets required for the Main Menu.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              Font = shared.Load<SpriteFont>("Font/menufont");

              content = shared;

              menuTemplate.Title = new TextLine("Puzzle Path", Font, new Color(192, 192, 192));

              // List that contains the menu buttons
              IList<MenuButton> items = menuTemplate.Items;

              // Create the Menu Buttons, attach what happens for each entry,
              // and add the menu buttons to the list of buttons.
              MenuButton playGameMenuEntry = new MenuButton("Play Game", Font);
              playGameMenuEntry.Selected += PlayGameMenuEntrySelected;
              items.Add(playGameMenuEntry);

              MenuButton creationModeMenuEntry = new MenuButton("Level Creator", Font);
              creationModeMenuEntry.Selected += creationModeMenuEntrySelected;
              items.Add(creationModeMenuEntry);

              MenuButton howToPlayMenuEntry = new MenuButton("How To Play", Font);
              howToPlayMenuEntry.Selected += howToPlayMenuEntrySelected;
              items.Add(howToPlayMenuEntry);

              MenuButton optionsMenuEntry = new MenuButton("Options", Font);
              optionsMenuEntry.Selected += OptionsMenuEntrySelected;
              items.Add(optionsMenuEntry);

              MenuButton creditsMenuEntry = new MenuButton("Credits", Font);
              creditsMenuEntry.Selected += CreditsMenuEntrySelected;
              items.Add(creditsMenuEntry);

              MenuButton exitMenuEntry = new MenuButton("Exit", Font);
              exitMenuEntry.Selected += OnCancel;
              items.Add(exitMenuEntry);
        }
コード例 #6
0
        /// <summary>
        /// Load the content that will be used to create the screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              Font = shared.Load<SpriteFont>("Font/menufont");
              int numberOfMinutes = CompletionTime / 60;
              int numberOfSeconds = CompletionTime % 60;

              string minutes;
              string seconds;

              minutes = Convert.ToString(numberOfMinutes);

              if (numberOfSeconds < 10) {
            seconds = "0" + numberOfSeconds;
              } else {
            seconds = Convert.ToString(numberOfSeconds);
              }

              detailsTemplate.Title = new TextLine(LevelName, Font, new Color(192, 192, 192));

              startMenuEntry = new MenuButton("Start", Font);
              startMenuEntry.Selected += StartMenuEntrySelected;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Right] = startMenuEntry;
              detailsTemplate.SelectedItem = DetailsTemplate.Selection.Right;

              exitMenuEntry = new MenuButton("Back", Font);
              exitMenuEntry.Selected += OnCancel;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Left] = exitMenuEntry;

              IList<IMenuLine> stats = detailsTemplate.Lines;
              stats.Clear();

              stats.Add(new TextLine("Status: " + (Completed ? "Completed" : "Incomplete"), Font, Color.White));
              stats.Add(new Spacer(Font.LineSpacing));
              stats.Add(new TextLine("Completion Time: " + minutes + ":" + seconds, Font, Color.White));
              stats.Add(new Spacer(Font.LineSpacing));
              stats.Add(new TextLine("Score: " + LevelScore, Font, Color.White));
        }
コード例 #7
0
        private void UpdateCurrentPage()
        {
            items.Clear();
              int previousLevel = 0;

              for (int count = 0; CurrentLevel < levelSet.Count && count < numberOfLevelsPerPage; count++) {
            levelInfo = levelSet.ElementAt<LevelInfo>(CurrentLevel);
            aLevelMenuEntry = new MenuButton(levelInfo.LevelName, font);
            aLevelMenuEntry.OriginalColor = Color.Gray;
            previousLevel = CurrentLevel - 1;

            if (previousLevel >= 0) {
              if (levelSet[previousLevel].Completed || levelInfo.LevelName == "Custom Level") { // Meh. -Jorenz
            aLevelMenuEntry.Selected += () => ALevelMenuEntrySelected(menuTemplate.SelectedItem);
            aLevelMenuEntry.OriginalColor = Color.White;
              }
            } else {
              previousLevel = 0;
              aLevelMenuEntry.Selected += () => ALevelMenuEntrySelected(menuTemplate.SelectedItem);
              aLevelMenuEntry.OriginalColor = Color.White;
            }

            items.Add(aLevelMenuEntry);
            CurrentLevel = CurrentLevel + 1;
            setOfLevels = count + 1;
              }

              if ((levelSet.Count - CurrentLevel) > 0) {
            items.Add(nextMenuEntry);
              }

              if ((CurrentLevel - numberOfLevelsPerPage) > 0) {
            items.Add(backMenuEntry);
              }

              items.Add(exitMenuEntry);
        }
コード例 #8
0
        /// <summary>
        /// Load content that will be used to create the level select screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              font = shared.Load<SpriteFont>("Font/menufont");
              content = shared;

              menuTemplate.Title = new TextLine("Select A Level", font, new Color(192, 192, 192));

              exitMenuEntry = new MenuButton("Back to Main Menu", font);
              exitMenuEntry.Selected += OnCancel;

              nextMenuEntry = new MenuButton("Next", font);
              nextMenuEntry.Selected += NextMenuEntrySelected;

              backMenuEntry = new MenuButton("Previous", font);
              backMenuEntry.Selected += BackMenuEntrySelected;

              UpdateCurrentPage();
        }
コード例 #9
0
        /// <summary>
        /// Load the buttons and the Content that will be used to display the Credits.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              SpriteFont titleFont = shared.Load<SpriteFont>("Font/menufont");
              SpriteFont textFont = shared.Load<SpriteFont>("Font/textfont");

              detailsTemplate.Title = new TextLine("Credits", titleFont, new Color(192, 192, 192));

              MenuButton exitMenuEntry = new MenuButton("Back", titleFont);
              exitMenuEntry.Selected += OnCancel;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Middle] = exitMenuEntry;
              detailsTemplate.SelectedItem = DetailsTemplate.Selection.Middle;

              IList<IMenuLine> credits = detailsTemplate.Lines;
              credits.Clear();

              credits.Add(new TextLine("Team Members", textFont, Color.White, 1.25f));
              credits.Add(new Spacer(textFont.LineSpacing));
              foreach (string name in TeamMembers)
            credits.Add(new TextLine(name, textFont, Color.Black, 1.25f));
              credits.Add(new Spacer(textFont.LineSpacing));
              credits.Add(new Spacer(textFont.LineSpacing));
              credits.Add(new TextLine("Organizations", textFont, Color.White, 1.25f));
              credits.Add(new Spacer(textFont.LineSpacing));
              foreach (string name in Organizations)
            credits.Add(new TextLine(name, textFont, Color.Black, 1.25f));
              foreach (string name in Individuals)
            credits.Add(new TextLine(name, textFont, Color.Black, 1.25f));
        }
コード例 #10
0
        /// <summary>
        /// Loads graphics content for this screen. This uses the shared ContentManager
        /// provided by the Game class, so the content will remain loaded forever.
        /// Whenever a subsequent MessageBoxScreen tries to load this same content,
        /// it will just get back another reference to the already loaded data.
        /// </summary>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);

              gradientTexture = shared.Load<Texture2D>("Texture/gradient");
              font = shared.Load<SpriteFont>("Font/menufont");

              messageBoxTemplate.Title = new TextLine(title, font, new Color(192, 192, 192));

              if (LeftButtonText != null) {
            MenuButton leftButton = new MenuButton(LeftButtonText, font);
            leftButton.Selected += LeftMenuEntrySelected;
            messageBoxTemplate.Buttons[MessageBoxTemplate.Selection.Left] = leftButton;
            messageBoxTemplate.SelectedItem = MessageBoxTemplate.Selection.Left;
              }

              if (MiddleButtonText != null) {
            MenuButton centerButton = new MenuButton(MiddleButtonText, font);
            centerButton.Selected += MiddleMenuEntrySelected;
            messageBoxTemplate.Buttons[MessageBoxTemplate.Selection.Middle] = centerButton;
              }

              if (RightButtonText != null) {
            MenuButton rightButton = new MenuButton(RightButtonText, font);
            rightButton.Selected += RightMenuEntrySelected;
            messageBoxTemplate.Buttons[MessageBoxTemplate.Selection.Right] = rightButton;
              }
        }
コード例 #11
0
        /// <summary>
        /// Load the content that will be used to create the help screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              Font = shared.Load<SpriteFont>("Font/menufont");

              foreach (string name in gameContent) {
            objectContent.Add(shared.Load<Texture2D>(name));
              }

              detailsTemplate.Title = new TextLine("Game Objects", Font, new Color(192, 192, 192));

              IList<IMenuLine> lines = detailsTemplate.Lines;
              lines.Clear();

              for (int i = 0; i < gameObjects.Length; ++i) {
            string text = gameObjects[i];
            Texture2D image = objectContent[i];

            TextLine caption = new TextLine(text, Font, Color.Black, 0.75f);
            caption.Align = TextAlignment.LEFT;
            lines.Add(new ImageMenuLine(image, caption));
              }

              exitMenuEntry = new MenuButton("Back", Font);
              exitMenuEntry.Selected += OnCancel;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Middle] = exitMenuEntry;
              detailsTemplate.SelectedItem = DetailsTemplate.Selection.Middle;
        }
コード例 #12
0
        /// <summary>
        /// Load the content that will be displayed on the screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              SpriteFont font = shared.Load<SpriteFont>("Font/menufont");
              content = shared;

              menuTemplate.Title = new TextLine("Paused", font, new Color(192, 192, 192));

              IList<MenuButton> items = menuTemplate.Items;

              // Create new menu buttons and attach to them events.
              // Add menu buttons the list that will be dislayed on the screen.
              MenuButton resumeGameMenuEntry = new MenuButton("Resume Game", font);
              resumeGameMenuEntry.Selected += OnCancel;
              items.Add(resumeGameMenuEntry);

              // Only allow the player to restart the level in simulation mode.
              MenuButton restartLevelMenuEntry = new MenuButton("Restart Level", font);
              restartLevelMenuEntry.Selected += RestartLevelMenuEntrySelected;
              if (!EditorMode) {
            items.Add(restartLevelMenuEntry);
              }

              MenuButton restartLevelEditor;
              if (EditorMode) {
            if (custom)
              restartLevelEditor = new MenuButton("Empty Level", font);
            else
              restartLevelEditor = new MenuButton("Restart Level Editor", font);
              } else {
            restartLevelEditor = new MenuButton("Back to Level Editor", font);
              }
              restartLevelEditor.Selected += RestartLevelEditorMenuEntrySelected;
              items.Add(restartLevelEditor);

              MenuButton howToPlayMenuEntry = new MenuButton("How to Play", font);
              howToPlayMenuEntry.Selected += HowToPlayMenuEntrySelected;
              items.Add(howToPlayMenuEntry);

              MenuButton levelSelectMenuEntry = new MenuButton("Back to Level Select", font);
              levelSelectMenuEntry.Selected += LevelSelectMenuEntrySelected;
              items.Add(levelSelectMenuEntry);

              MenuButton quitGameMenuEntry = new MenuButton("Back to Main Menu", font);
              quitGameMenuEntry.Selected += QuitGameMenuEntrySelected;
              items.Add(quitGameMenuEntry);
        }
コード例 #13
0
        /// <summary>
        /// Load the content that will be used to display the screen. Calculate
        /// the players score and display all the data on the screen.
        /// </summary>
        /// <param name="shared"></param>
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);

              content = shared;
              SpriteFont font = shared.Load<SpriteFont>("Font/menufont");

              // Calculate the players score based on the data of the
              // players actions in the game.
              int treasureScore = 500 * levelData.TreasuresCollected;
              int ballsLeftScore = 150 * levelData.BallsLeft;
              string fullPath = Configuration.UserDataPath + Path.DirectorySeparatorChar + "levellist.xml";
              int timeSpentInSeconds = levelData.TimeSpent % 60;
              int timeSpentInMinutes = levelData.TimeSpent / 60;
              int parTimeInSeconds = levelData.ParTime % 60;
              int parTimeInMinutes = levelData.ParTime / 60;
              string timeSpentSeconds = Convert.ToString(timeSpentInSeconds);
              string parTimeSeconds = Convert.ToString(parTimeInSeconds);

              // Add a zero in front of the number of seconds if the
              // seconds is less than 10. This is for the formatting of the time.
              if (timeSpentInSeconds < 10) {
            timeSpentSeconds = "0" + timeSpentInSeconds;
              }

              if (parTimeInSeconds < 10) {
            parTimeSeconds = "0" + parTimeInSeconds;
              }

              detailsTemplate = new DetailsTemplate();

              // Load the list of levels
              levelSet = LevelGroup.Load(fullPath);

              detailsTemplate.Title = new TextLine("Congratulations, Level Complete.", font, Color.White);

              IList<IMenuLine> description = detailsTemplate.Lines;

              // Add the description of how the user's score was generated.
              description.Add(new TextLine("Treasures obtained: " + levelData.TreasuresCollected + "/" + levelData.TreasuresInLevel +
              " (+" + treasureScore + ")", font, Color.White));
              description.Add(new TextLine("Balls remaining: " + levelData.BallsLeft + " (+" + ballsLeftScore + ")", font, Color.White));
              description.Add(new TextLine("Time spent: " + timeSpentInMinutes + ":" + timeSpentSeconds, font, Color.White));
              description.Add(new TextLine("Par time: " + parTimeInMinutes + ":" + parTimeSeconds, font, Color.White));
              if (levelData.TimeSpent <= levelData.ParTime) {
            description.Add(new TextLine("Par time met! (+100)", font, Color.White));
              }

              description.Add(new TextLine("Your score is: " + levelData.Score, font, Color.White));

              // Create the Buttons and attach the events.
              retryMenuEntry = new MenuButton("Retry Level", font);
              retryMenuEntry.Selected += RetryMenuEntrySelected;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Left] = retryMenuEntry;

              levelSelectMenuEntry = new MenuButton("Level Select", font);
              levelSelectMenuEntry.Selected += LevelSelectMenuEntrySelected;
              detailsTemplate.Buttons[DetailsTemplate.Selection.Middle] = levelSelectMenuEntry;
              detailsTemplate.SelectedItem = DetailsTemplate.Selection.Middle;

              // Check if there is a next level in the list. If there exist one
              // display the next Level Button, otherwise don't.
              if (levelSet.FindNextLevel(levelData.LevelName) != null) {
            nextLevelMenuEntry = new MenuButton("Next Level", font);
            nextLevelMenuEntry.Selected += NextLevelMenuEntrySelected;
            detailsTemplate.Buttons[DetailsTemplate.Selection.Right] = nextLevelMenuEntry;
            detailsTemplate.SelectedItem = DetailsTemplate.Selection.Right;
              }

              SaveUserProgress();
        }
コード例 #14
0
        public override void LoadContent(ContentManager shared)
        {
            base.LoadContent(shared);
              SpriteFont font = shared.Load<SpriteFont>("Font/menufont");

              menuTemplate.Title = new TextLine("Options", font, new Color(192, 192, 192));

              IList<MenuButton> items = menuTemplate.Items;

              soundMenuEntry = new MenuButton(string.Empty, font);
              soundMenuEntry.Selected += SoundMenuEntrySelected;
              items.Add(soundMenuEntry);

              controllerConfigurationMenuEntry = new MenuButton(string.Empty, font);
              controllerConfigurationMenuEntry.Selected += ControllerConfigurationMenuEntrySelected;
              items.Add(controllerConfigurationMenuEntry);

              apply = new MenuButton("Apply Changes", font);
              apply.Selected += OnApply;
              items.Add(apply);

              back = new MenuButton("Cancel", font);
              back.Selected += OnCancel;
              items.Add(back);

              // Warning messages
              firstWarningLine = new TextLine("The currently selected controller is not connected.", font, Color.Black);
              secondWarningLine = new TextLine("The change will not take effect.", font, Color.Black);

              // Get the current settings of the game.
              sound = Profile.Prefs.PlaySounds;
              currentControllerType = (int)Controller.InputType;
              currentControllerConnected = true; // Well, it has to be to even open this menu (for now).

              SetMenuEntryText();
        }