Пример #1
0
        /// <summary>
        /// Constructor fills in the menu contents.
        /// </summary>
        public MainMenuScreen()
            : base()
        {
            // add the New Game entry
            newGameMenuEntry = new MenuEntry("New Game");
            newGameMenuEntry.Description = "Start a New Game";
            newGameMenuEntry.Font = Fonts.HeaderFont;
            newGameMenuEntry.Position = ScaledVector2.GetScaledVector(765, 0f);
            newGameMenuEntry.Selected += NewGameMenuEntrySelected;
            MenuEntries.Add(newGameMenuEntry);

            // add the Save Game menu entry,
            // if the game has started but is not in combat
            if (Session.IsActive && !CombatEngine.IsActive)
            {
                saveGameMenuEntry = new MenuEntry("Save Game");
                saveGameMenuEntry.Description = "Save the Game";
                saveGameMenuEntry.Font = Fonts.HeaderFont;
                saveGameMenuEntry.Position =  ScaledVector2.GetScaledVector(790, 0f);
                saveGameMenuEntry.Selected += SaveGameMenuEntrySelected;
                MenuEntries.Add(saveGameMenuEntry);
            }
            else
            {
                saveGameMenuEntry = null;
            }

            // add the Load Game menu entry
            loadGameMenuEntry = new MenuEntry("Load Game");
            loadGameMenuEntry.Description = "Load the Game";
            loadGameMenuEntry.Font = Fonts.HeaderFont;
            loadGameMenuEntry.Position = ScaledVector2.GetScaledVector(750, 0f);
            loadGameMenuEntry.Selected += LoadGameMenuEntrySelected;
            MenuEntries.Add(loadGameMenuEntry);

            // add the Controls menu entry
            controlsMenuEntry = new MenuEntry("Controls");
            controlsMenuEntry.Description = "View Game Controls";
            controlsMenuEntry.Font = Fonts.HeaderFont;
            controlsMenuEntry.Position = ScaledVector2.GetScaledVector(770, 0f);
            controlsMenuEntry.Selected += ControlsMenuEntrySelected;
            //MenuEntries.Add(controlsMenuEntry);

            // add the Help menu entry
            helpMenuEntry = new MenuEntry("Help");
            helpMenuEntry.Description = "View Game Help";
            helpMenuEntry.Font = Fonts.HeaderFont;
            helpMenuEntry.Position = ScaledVector2.GetScaledVector(750, 0f);
            helpMenuEntry.Selected += HelpMenuEntrySelected;
            MenuEntries.Add(helpMenuEntry);

            // create the Exit menu entry
            exitGameMenuEntry = new MenuEntry("Exit");
            exitGameMenuEntry.Description = "Quit the Game";
            exitGameMenuEntry.Font = Fonts.HeaderFont;
            exitGameMenuEntry.Position = ScaledVector2.GetScaledVector(770, 0f);
            exitGameMenuEntry.Selected += OnCancel;
            MenuEntries.Add(exitGameMenuEntry);

            // start the menu music
            AudioManager.PushMusic("MainTheme",true);
        }
Пример #2
0
        /// <summary>
        /// Load the graphics content for this screen.
        /// </summary>
        public override void LoadContent()
        {
            // load the textures
            ContentManager content = ScreenManager.Game.Content;
            SpriteFont copperPlate = ScreenManager.Game.Content.Load<SpriteFont>(@"Fonts\copperPlate");
            float x = 110*1.5f;
            float y = 200*1.5f;

            //Load the background loop
            mainLoop = content.Load<Video>(@"Video\loopmenu3");

            // add the New Game entry
            newGameMenuEntry = new MenuEntry("Start");
            newGameMenuEntry.Description = "Start the game";
            newGameMenuEntry.Font = copperPlate;
            //newGameMenuEntry.Texture = content.Load<Texture2D>(@"Textures\MainMenu\MainMenuPlank");
            newGameMenuEntry.Position = new Vector2(x, y);

            newGameMenuEntry.Selected += NewGameMenuEntrySelected;
            MenuEntries.Add(newGameMenuEntry);

            //Add the options entry
            optionsMenuEntry = new MenuEntry("Options");
            optionsMenuEntry.Description = "Configure the game";
            optionsMenuEntry.Font = copperPlate;
            optionsMenuEntry.Position = new Vector2(x, y += 36 * 1.5f);
            optionsMenuEntry.Selected += OptionsMenuEntrySelected;
            MenuEntries.Add(optionsMenuEntry);

            //Add extras entry
            extrasMenuEntry = new MenuEntry("Extras");
            extrasMenuEntry.Description = "Gaming goodies";
            extrasMenuEntry.Font = copperPlate;
            extrasMenuEntry.Position = new Vector2(x, y += 36 * 1.5f);
            extrasMenuEntry.Selected += ExtrasMenuEntrySelected;
            MenuEntries.Add(extrasMenuEntry);

            // create the Exit menu entry
            exitGameMenuEntry = new MenuEntry("Exit");
            exitGameMenuEntry.Description = "Quit the Game";
            exitGameMenuEntry.Font = copperPlate;
            exitGameMenuEntry.Position = new Vector2(x, y+36*1.5f);
            exitGameMenuEntry.Selected += OnCancel;
            MenuEntries.Add(exitGameMenuEntry);

            selectTexture = content.Load<Texture2D>(@"Textures\Buttons\AButton");

            // calculate the texture positions
            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            Vector2 backgroundPosition = new Vector2(viewport.Width / 2,
                                                    viewport.Height/ 2);
            selectPosition = backgroundPosition + new Vector2(1120, 610);

            // now that they have textures, set the proper positions on the menu entries
            for (int i = 0; i < MenuEntries.Count; i++)
            {
                MenuEntries[i].Position = new Vector2(MenuEntries[i].Position.X, MenuEntries[i].Position.Y);
            }

            base.LoadContent();
        }
		private void prepareMenuItems(){
			if (Session.IsActive)
			{
				resumeMenuEntry = new MenuEntry("Resume Game");
				resumeMenuEntry.Description = "Resume the Game";
				resumeMenuEntry.Font = Fonts.HeaderFont;
				resumeMenuEntry.Position = new Vector2(800 * scaleX, 0f);
				resumeMenuEntry.Selected += ResumeGameMenuEntrySelected;
				MenuEntries.Add(resumeMenuEntry);
			}
			else
			{
				resumeMenuEntry = null;
			}
			// add the New Game entry
			newGameMenuEntry = new MenuEntry("New Game");
			newGameMenuEntry.Description = "Start a New Game";
			newGameMenuEntry.Font = Fonts.HeaderFont;
			newGameMenuEntry.Position = new Vector2(800 * scaleX, 0f);
			newGameMenuEntry.Selected += NewGameMenuEntrySelected;
			MenuEntries.Add(newGameMenuEntry);


			if (Session.IsActive && !CombatEngine.IsActive)
			{
				saveGameMenuEntry = new MenuEntry("Save Game");
				saveGameMenuEntry.Description = "Save the Game";
				saveGameMenuEntry.Font = Fonts.HeaderFont;
				saveGameMenuEntry.Position = new Vector2(800 * scaleX, 0f);
				saveGameMenuEntry.Selected += SaveGameMenuEntrySelected;
				//      saveGameMenuEntry.Texture = ScreenManager.Game.Content.Load<Texture2D>(@"Textures\MainMenu\MainMenuPlank02");
				MenuEntries.Add(saveGameMenuEntry);
			}
			else
			{
				saveGameMenuEntry = null;
			}


			// add the Load Game menu entry
			loadGameMenuEntry = new MenuEntry("Load Game");
			loadGameMenuEntry.Description = "Load the Game";
			loadGameMenuEntry.Font = Fonts.HeaderFont;
			loadGameMenuEntry.Position = new Vector2(800 * scaleX, 0f);
			loadGameMenuEntry.Selected += LoadGameMenuEntrySelected;
			MenuEntries.Add(loadGameMenuEntry);

			//// add the Controls menu entry
			//controlsMenuEntry = new MenuEntry("Controls");
			//controlsMenuEntry.Description = "View Game Controls";
			//controlsMenuEntry.Font = Fonts.HeaderFont;
			//controlsMenuEntry.Position = new Vector2(800, 0f);
			//controlsMenuEntry.Selected += ControlsMenuEntrySelected;
			//MenuEntries.Add(controlsMenuEntry);

			// add the Help menu entry
			helpMenuEntry = new MenuEntry("Settings");
			helpMenuEntry.Description = "View Game Help";
			helpMenuEntry.Font = Fonts.HeaderFont;
			helpMenuEntry.Position = new Vector2(800 * scaleX, 0f);
			helpMenuEntry.Selected += HelpMenuEntrySelected;
			MenuEntries.Add(helpMenuEntry);

			// create the Exit menu entry
			exitGameMenuEntry = new MenuEntry("Exit");
			exitGameMenuEntry.Description = "Quit the Game";
			exitGameMenuEntry.Font = Fonts.HeaderFont;
			exitGameMenuEntry.Position = new Vector2(800 * scaleX, 0f);
			exitGameMenuEntry.Selected += OnCancel;
			MenuEntries.Add(exitGameMenuEntry);

			funnyMessage = getRandomMessage();

			// start the menu music
			//AudioManager.PushMusic("MainTheme");

		}