Exemplo n.º 1
0
        /// <summary>
        /// Load the graphics content
        /// </summary>
        /// <param name="sprite">SpriteBatch</param>
        /// <param name="screenWidth">Width of the screen</param>
        /// <param name="screenHeight">Height of the screen</param>
        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;

            backTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\PopupScreen");
            selectIconTexture =
                content.Load <Texture2D>(@"Textures\Buttons\rpgbtn");
            portraitBackTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\PlayerSelected");
            headerTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\Caption");
            lineTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\SeparationLine");
            scrollUpTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\ScrollUp");
            scrollDownTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\ScrollDown");
            fadeTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\FadeScreen");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            backgroundPosition.X = (viewport.Width - backTexture.Width * ScaledVector2.DrawFactor) / 2;
            backgroundPosition.Y = (viewport.Height - backTexture.Height * ScaledVector2.DrawFactor) / 2;

            screenSize = new Vector2(viewport.Width, viewport.Height);
            fadeDest   = new Rectangle(0, 0, viewport.Width, viewport.Height);

            titlePosition.X = (screenSize.X -
                               Fonts.HeaderFont.MeasureString(titleText).X) / 2;
            titlePosition.Y = backgroundPosition.Y + lineSpacing;

            selectIconPosition.X = screenSize.X / 2 + 185 * ScaledVector2.ScaleFactor;
            selectIconPosition.Y = backgroundPosition.Y + 520f * ScaledVector2.ScaleFactor;
            selectPosition.X     = selectIconPosition.X -
                                   Fonts.ButtonNamesFont.MeasureString(selectString).X - 10f * ScaledVector2.ScaleFactor;
            selectPosition.Y = selectIconPosition.Y;

            portraitPosition = backgroundPosition + ScaledVector2.GetScaledVector(143f, 155f);
            backPosition     = backgroundPosition + ScaledVector2.GetScaledVector(140f, 120f);

            playerNamePosition  = backgroundPosition + ScaledVector2.GetScaledVector(220f, 130f);
            playerClassPosition = backgroundPosition + ScaledVector2.GetScaledVector(220f, 155f);
            playerLvlPosition   = backgroundPosition + ScaledVector2.GetScaledVector(220f, 175f);

            topLinePosition = backgroundPosition + ScaledVector2.GetScaledVector(380f, 160f);
            textPosition    = backgroundPosition + ScaledVector2.GetScaledVector(335f, 0);
            levelPosition   = backgroundPosition + ScaledVector2.GetScaledVector(540f, 320f);
            iconPosition    = backgroundPosition + ScaledVector2.GetScaledVector(155f, 303f);
            linePosition    = backgroundPosition + ScaledVector2.GetScaledVector(142f, 285f);

            scrollUpPosition   = backgroundPosition + ScaledVector2.GetScaledVector(810f, 300f);
            scrollDownPosition = backgroundPosition + ScaledVector2.GetScaledVector(810f, 480f);

            playerDamagePosition = backgroundPosition + ScaledVector2.GetScaledVector(560f, 130f);
            spellUpgradePosition = backgroundPosition + ScaledVector2.GetScaledVector(380f, 250f);

            headerPosition = backgroundPosition + ScaledVector2.GetScaledVector(120f, 248f);
        }
        /// <summary>
        /// Draw the character stats screen and text
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            spriteBatch.Draw(fadeTexture, ScaledVector2.GetScaledVector(1280, 720), null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            currentTextPosition = textPosition;

            spriteBatch.Draw(playerInfoScreen, popupPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            // DrawButtons
            DrawButtons();

            // Draw Heros
            DrawViewablePlayers();

            // Display Title of the Screen
            spriteBatch.DrawString(Fonts.HeaderFont, "Choose Player", titlePosition,
                                   Fonts.TitleColor);

            spriteBatch.End();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Load the graphics content for this screen.
        /// </summary>
        public override void LoadContent()
        {
            // load the textures
            ContentManager content = ScreenManager.Game.Content;

            backgroundTexture      = content.Load <Texture2D>(@"Textures\MainMenu\MainMenu");
            descriptionAreaTexture =
                content.Load <Texture2D>(@"Textures\MainMenu\MainMenuInfoSpace");
            iconTexture   = content.Load <Texture2D>(@"Textures\MainMenu\GameLogo");
            plankTexture1 =
                content.Load <Texture2D>(@"Textures\MainMenu\MainMenuPlank");
            plankTexture2 =
                content.Load <Texture2D>(@"Textures\MainMenu\MainMenuPlank02");
            plankTexture3 =
                content.Load <Texture2D>(@"Textures\MainMenu\MainMenuPlank03");
            backTexture   = content.Load <Texture2D>(@"Textures\Buttons\rpgBtn");
            selectTexture = content.Load <Texture2D>(@"Textures\Buttons\rpgBtn");

            // calculate the texture positions
            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            backgroundPosition = new Vector2(
                (viewport.Width - (backgroundTexture.Width * ScaledVector2.DrawFactor)) / 2,
                (viewport.Height - (backgroundTexture.Height * ScaledVector2.DrawFactor)) / 2);
            descriptionAreaPosition     = backgroundPosition + ScaledVector2.GetScaledVector(158, 130);
            descriptionAreaTextPosition = backgroundPosition + ScaledVector2.GetScaledVector(158, 350);
            iconPosition   = backgroundPosition + ScaledVector2.GetScaledVector(170, 80);
            backPosition   = backgroundPosition + ScaledVector2.GetScaledVector(220, 605);
            selectPosition = backgroundPosition + ScaledVector2.GetScaledVector(1060, 600);

            // set the textures on each menu entry
            newGameMenuEntry.Texture = plankTexture3;
            if (saveGameMenuEntry != null)
            {
                saveGameMenuEntry.Texture = plankTexture2;
            }
            loadGameMenuEntry.Texture = plankTexture1;
            controlsMenuEntry.Texture = plankTexture2;
            helpMenuEntry.Texture     = plankTexture3;
            exitGameMenuEntry.Texture = plankTexture1;

            // 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 + 50,
                    (500 * ScaledVector2.ScaleFactor) -
                    (((MenuEntries[i].Texture.Height * ScaledVector2.DrawFactor) + 10) *
                     (MenuEntries.Count - 1 - i)));
            }

            base.LoadContent();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Loads the graphics content for this screen.
        /// </summary>
        public override void LoadContent()
        {
            // load the textures
            ContentManager content = ScreenManager.Game.Content;

            backgroundTexture =
                content.Load <Texture2D>(@"Textures\MainMenu\MainMenu");
            plankTexture =
                content.Load <Texture2D>(@"Textures\MainMenu\MainMenuPlank03");
            backTexture =
                content.Load <Texture2D>(@"Textures\Buttons\rpgbtn");
            selectTexture =
                content.Load <Texture2D>(@"Textures\Buttons\rpgbtn");
            deleteTexture =
                content.Load <Texture2D>(@"Textures\Buttons\rpgbtn");
            lineBorderTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\LineBorder");
            highlightTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\HighlightLarge");
            arrowTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\SelectionArrow");

            // calculate the image positions
            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            backgroundPosition = new Vector2(
                (viewport.Width - backgroundTexture.Width * ScaledVector2.DrawFactor) / 2,
                (viewport.Height - backgroundTexture.Height * ScaledVector2.DrawFactor) / 2);
            plankPosition = backgroundPosition + new Vector2(
                backgroundTexture.Width * ScaledVector2.DrawFactor / 2 - plankTexture.Width
                * ScaledVector2.DrawFactor / 2,
                60f * ScaledVector2.ScaleFactor);
            backPosition       = backgroundPosition + ScaledVector2.GetScaledVector(220, 590);
            selectPosition     = backgroundPosition + ScaledVector2.GetScaledVector(900, 590);
            deletePosition     = backgroundPosition + ScaledVector2.GetScaledVector(400f, 590);
            lineBorderPosition = backgroundPosition + ScaledVector2.GetScaledVector(200, 570);

            // calculate the text positions
            titleTextPosition = new Vector2(
                plankPosition.X + (plankTexture.Width * ScaledVector2.DrawFactor -
                                   Fonts.HeaderFont.MeasureString("Load").X) / 2,
                plankPosition.Y + (plankTexture.Height * ScaledVector2.DrawFactor -
                                   Fonts.HeaderFont.MeasureString("Load").Y) / 2);
            backTextPosition      = new Vector2(backPosition.X + 30, backPosition.Y + 5);
            deleteTextPosition.X += deleteTexture.Width * ScaledVector2.DrawFactor;
            selectTextPosition    = new Vector2(
                selectPosition.X - Fonts.ButtonNamesFont.MeasureString("Select").X - 5,
                selectPosition.Y + 5);

            base.LoadContent();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Load the graphics content
        /// </summary>
        /// <param name="batch">SpriteBatch object</param>
        /// <param name="screenWidth">Width of the screen</param>
        /// <param name="screenHeight">Height of the screen</param>
        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;

            fadeTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\FadeScreen");
            backgroundTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\PopupScreen");
            scrollTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\ScrollButtons");
            selectButtonTexture = content.Load <Texture2D>(@"Textures\Buttons\rpgbtn");
            backButtonTexture   = content.Load <Texture2D>(@"Textures\Buttons\rpgbtn");
            lineTexture         =
                content.Load <Texture2D>(@"Textures\GameScreens\SeparationLine");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            upperArrow = new Rectangle((int)scrollPosition.X - 40, (int)scrollPosition.Y - 40,
                                       80, 80);
            lowerArrow = new Rectangle((int)scrollPosition.X - 40, (int)scrollPosition.Y + 100,
                                       80, 80);

            backgroundPosition.X = (viewport.Width - (backgroundTexture.Width * ScaledVector2.DrawFactor)) / 2;
            backgroundPosition.Y = (viewport.Height - (backgroundTexture.Height * ScaledVector2.DrawFactor)) / 2;


            selectButtonPosition.X = viewport.Width / 2 + 130 * ScaledVector2.ScaleFactor;
            selectButtonPosition.Y = backgroundPosition.Y + 520f * ScaledVector2.ScaleFactor;
            selectPosition.X       = selectButtonPosition.X -
                                     Fonts.ButtonNamesFont.MeasureString(selectText).X - 10f;
            selectPosition.Y = selectButtonPosition.Y;

            backPosition.X       = viewport.Width / 2 - 140f * ScaledVector2.ScaleFactor;
            backPosition.Y       = backgroundPosition.Y + 520f * ScaledVector2.ScaleFactor;
            backButtonPosition.X = backPosition.X - (backButtonTexture.Width *
                                                     ScaledVector2.DrawFactor) - 10;
            backButtonPosition.Y = backPosition.Y;

            scrollPosition = backgroundPosition + ScaledVector2.GetScaledVector(820f, 200f);

            topLinePosition.X = (viewport.Width - (lineTexture.Width * ScaledVector2.DrawFactor)) /
                                2 - 30f * ScaledVector2.ScaleFactor;
            topLinePosition.Y = 200f * ScaledVector2.ScaleFactor;

            bottomLinePosition.X = topLinePosition.X;
            bottomLinePosition.Y = 550f * ScaledVector2.ScaleFactor;

            titlePosition.X = (viewport.Width -
                               Fonts.HeaderFont.MeasureString(titleText).X) / 2;
            titlePosition.Y = backgroundPosition.Y + 70f * ScaledVector2.ScaleFactor;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Draw the chest's gold at the given position in the list.
        /// </summary>
        /// <param name="position">The position to draw the gold at.</param>
        /// <param name="isSelected">If true, the gold is selected.</param>
        protected virtual void DrawGoldEntry(Vector2 position, bool isSelected)
        {
            SpriteBatch spriteBatch  = ScreenManager.SpriteBatch;
            Vector2     drawPosition = position;

            // draw the icon
            spriteBatch.Draw(goldTexture,
                             drawPosition + iconOffset + ScaledVector2.GetScaledVector(0f, 7f), Color.White);

            // draw the name
            Color color = isSelected ? Fonts.HighlightColor : Fonts.DisplayColor;

            drawPosition.Y += listLineSpacing / 4;
            drawPosition.X += nameColumnInterval;
            spriteBatch.DrawString(Fonts.GearInfoFont, "Gold", drawPosition, color);

            // skip the power text
            drawPosition.X += powerColumnInterval;

            // draw the quantity
            drawPosition.X += quantityColumnInterval;
            if (isSelected)
            {
                // draw the left selection arrow
                drawPosition.X -= leftQuantityArrow.Width;
                spriteBatch.Draw(leftQuantityArrow,
                                 new Vector2(drawPosition.X, drawPosition.Y - 4), Color.White);
                drawPosition.X += leftQuantityArrow.Width;
                // draw the selected quantity ratio
                string quantityText = selectedQuantity.ToString() + "/" +
                                      chestEntry.Content.Gold.ToString();
                spriteBatch.DrawString(Fonts.GearInfoFont, quantityText,
                                       drawPosition, color);
                drawPosition.X += Fonts.GearInfoFont.MeasureString(quantityText).X;
                // draw the right selection arrow
                spriteBatch.Draw(rightQuantityArrow,
                                 new Vector2(drawPosition.X, drawPosition.Y - 4), Color.White);
                drawPosition.X += rightQuantityArrow.Width;
            }
            else
            {
                // draw the remaining quantity
                spriteBatch.DrawString(Fonts.GearInfoFont,
                                       chestEntry.Content.Gold.ToString(), drawPosition, color);
            }
        }
        /// <summary>
        /// Loads the graphics content from the content manager.
        /// </summary>
        public override void LoadContent()
        {
            ContentManager content  = ScreenManager.Game.Content;
            Viewport       viewport = ScreenManager.GraphicsDevice.Viewport;

            backgroundTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\PopupScreen");
            backIconTexture =
                content.Load <Texture2D>(@"Textures\Buttons\rpgbtn");
            scrollTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\ScrollButtons");
            lineTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\SeparationLine");
            fadeTexture = content.Load <Texture2D>(@"Textures\GameScreens\FadeScreen");

            // Get the screen positions
            screenSize = new Vector2(viewport.Width, viewport.Height);
            fadeDest   = new Rectangle(viewport.X, viewport.Y,
                                       viewport.Width, viewport.Height);

            backgroundPosition = new Vector2(
                (viewport.Width - (backgroundTexture.Width * ScaledVector2.DrawFactor)) / 2,
                (viewport.Height - (backgroundTexture.Height * ScaledVector2.DrawFactor)) / 2);
            scrollPosition = backgroundPosition + ScaledVector2.GetScaledVector(820f, 200f);

            upperArrow = new Rectangle((int)scrollPosition.X - 40, (int)scrollPosition.Y - 40,
                                       80, 80);
            lowerArrow = new Rectangle((int)scrollPosition.X - 40, (int)scrollPosition.Y + 100,
                                       80, 80);

            titlePosition = new Vector2(
                (screenSize.X - Fonts.HeaderFont.MeasureString(titleString).X) / 2,
                backgroundPosition.Y + 70f * ScaledVector2.ScaleFactor);

            backTextPosition = new Vector2(screenSize.X / 2 - 200 * ScaledVector2.ScaleFactor,
                                           backgroundPosition.Y + 500f * ScaledVector2.ScaleFactor);
            backIconPosition = new Vector2(
                backTextPosition.X - (backIconTexture.Width * ScaledVector2.DrawFactor) - 10f, backTextPosition.Y);

            topLinePosition = new Vector2(
                (viewport.Width - (lineTexture.Width * ScaledVector2.DrawFactor)) / 2 - 30f, 200f *
                ScaledVector2.ScaleFactor);
            bottomLinePosition = new Vector2(topLinePosition.X, 550f * ScaledVector2.ScaleFactor);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Load the graphics content from the content manager.
        /// </summary>
        public override void LoadContent()
        {
            ContentManager content = ScreenManager.Game.Content;

            backTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\PopupScreen");
            selectIconTexture =
                content.Load <Texture2D>(@"Textures\Buttons\rpgbtn");
            scrollUpTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\ScrollUp");
            scrollDownTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\ScrollDown");
            lineTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\SeparationLine");
            fadeTexture = content.Load <Texture2D>(@"Textures\GameScreens\FadeScreen");

            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            fadeDest = new Rectangle(viewport.X, viewport.Y, viewport.Width,
                                     viewport.Height);
            backgroundPosition.X = (viewport.Width - backTexture.Width * ScaledVector2.DrawFactor) / 2;
            backgroundPosition.Y = (viewport.Height - backTexture.Height * ScaledVector2.DrawFactor) / 2;

            screenSize = new Vector2(viewport.Width, viewport.Height);

            selectIconPosition.X = screenSize.X / 2 + 120 * ScaledVector2.ScaleFactor;
            selectIconPosition.Y = backgroundPosition.Y + 520f * ScaledVector2.ScaleFactor;
            selectPosition.X     = selectIconPosition.X -
                                   Fonts.ButtonNamesFont.MeasureString(selectString).X - 10f * ScaledVector2.ScaleFactor;
            selectPosition.Y = backgroundPosition.Y + 530f * ScaledVector2.ScaleFactor;

            textPosition = backgroundPosition + ScaledVector2.GetScaledVector(335f, 320f);
            iconPosition = backgroundPosition + ScaledVector2.GetScaledVector(155f, 303f);
            linePosition = backgroundPosition + ScaledVector2.GetScaledVector(142f, 285f);

            scrollUpPosition   = backgroundPosition + ScaledVector2.GetScaledVector(810f, 300f);
            scrollDownPosition = backgroundPosition + ScaledVector2.GetScaledVector(810f, 480f);

            xpAwardPosition   = backgroundPosition + ScaledVector2.GetScaledVector(160f, 180f);
            goldAwardPosition = backgroundPosition + ScaledVector2.GetScaledVector(160f, 210f);
            itemAwardPosition = backgroundPosition + ScaledVector2.GetScaledVector(160f, 240f);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Draws the help screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            spriteBatch.Draw(backgroundTexture, Vector2.Zero, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            spriteBatch.Draw(plankTexture, plankPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            spriteBatch.Draw(backTexture, backPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            spriteBatch.Draw(lineBorderTexture, linePosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            string  text         = "Back";
            Vector2 textPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, text,
                                                                   new Rectangle((int)backPosition.X, (int)backPosition.Y,
                                                                                 backTexture.Width, backTexture.Height));

            spriteBatch.DrawString(Fonts.ButtonNamesFont, text, textPosition, Color.White);

            spriteBatch.Draw(scrollUpTexture, scrollUpPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            spriteBatch.Draw(scrollDownTexture, scrollDownPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            spriteBatch.DrawString(Fonts.HeaderFont, "Help", titlePosition,
                                   Fonts.TitleColor);

            for (int i = 0; i < maxLineDisplay; i++)
            {
                spriteBatch.DrawString(Fonts.DescriptionFont, textLines[startIndex + i],
                                       ScaledVector2.GetScaledVector(360, 200 + (Fonts.DescriptionFont.LineSpacing + 10) * i),
                                       Color.Black);
            }

            spriteBatch.End();
        }
Exemplo n.º 10
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);
        }
Exemplo n.º 11
0
        /// <summary>
        /// Loads the graphics content required for this screen.
        /// </summary>
        public override void LoadContent()
        {
            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;

            keyboardInfo.totalActionList = InputManager.ActionMaps;
            keyboardInfo.selectedIndex   = 0;

            const int leftStringsPosition = (int)(400);
            const int rightStringPosition = (int)(818);

            float height = Fonts.DescriptionFont.LineSpacing - 5;

            // Set the data for gamepad control to display
            leftStrings[0].text         = "Page Left";
            leftStrings[0].textPosition = ScaledVector2.GetScaledVector(leftStringsPosition -
                                                                        Fonts.DescriptionFont.MeasureString(leftStrings[0].text).X, 170);

            leftStrings[1].text         = "N/A";
            leftStrings[1].textPosition = ScaledVector2.GetScaledVector(leftStringsPosition -
                                                                        Fonts.DescriptionFont.MeasureString(leftStrings[1].text).X, 220);

            leftStrings[2].text         = "Main Menu";
            leftStrings[2].textPosition = ScaledVector2.GetScaledVector(leftStringsPosition -
                                                                        Fonts.DescriptionFont.MeasureString(leftStrings[2].text).X, 290);

            leftStrings[3].text         = "Exit Game";
            leftStrings[3].textPosition = ScaledVector2.GetScaledVector(leftStringsPosition -
                                                                        Fonts.DescriptionFont.MeasureString(leftStrings[3].text).X, 340);

            leftStrings[4].text         = "Navigation";
            leftStrings[4].textPosition = ScaledVector2.GetScaledVector(leftStringsPosition -
                                                                        Fonts.DescriptionFont.MeasureString(leftStrings[4].text).X, 400);

            leftStrings[5].text         = "Navigation";
            leftStrings[5].textPosition = ScaledVector2.GetScaledVector(leftStringsPosition -
                                                                        Fonts.DescriptionFont.MeasureString(leftStrings[5].text).X, 455);

            leftStrings[6].text         = "N/A";
            leftStrings[6].textPosition = ScaledVector2.GetScaledVector(leftStringsPosition -
                                                                        Fonts.DescriptionFont.MeasureString(leftStrings[6].text).X, 510);


            rightStrings[0].text         = "Page Right";
            rightStrings[0].textPosition = ScaledVector2.GetScaledVector(rightStringPosition, 170);

            rightStrings[1].text         = "N/A";
            rightStrings[1].textPosition = ScaledVector2.GetScaledVector(rightStringPosition, 230);

            rightStrings[2].text         = "Character Management";
            rightStrings[2].textPosition = ScaledVector2.GetScaledVector(rightStringPosition, 295);

            rightStrings[3].text         = "Back";
            rightStrings[3].textPosition = ScaledVector2.GetScaledVector(rightStringPosition, 355);

            rightStrings[4].text         = "OK";
            rightStrings[4].textPosition = ScaledVector2.GetScaledVector(rightStringPosition, 435);

            rightStrings[5].text         = "Drop Gear";
            rightStrings[5].textPosition = ScaledVector2.GetScaledVector(rightStringPosition, 510);

            ContentManager content = ScreenManager.Game.Content;

            backgroundTexture =
                content.Load <Texture2D>(@"Textures\MainMenu\MainMenu");
            keyboardTexture =
                content.Load <Texture2D>(@"Textures\MainMenu\KeyboardBkgd");
            plankTexture =
                content.Load <Texture2D>(@"Textures\MainMenu\MainMenuPlank03");
            backTexture =
                content.Load <Texture2D>(@"Textures\Buttons\BButton");
            baseBorderTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\LineBorder");
            controlPadTexture =
                content.Load <Texture2D>(@"Textures\MainMenu\ControlJoystick");
            scrollUpTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\ScrollUp");
            scrollDownTexture =
                content.Load <Texture2D>(@"Textures\GameScreens\ScrollDown");
            rightTriggerButton =
                content.Load <Texture2D>(@"Textures\Buttons\RightTriggerButton");
            leftTriggerButton =
                content.Load <Texture2D>(@"Textures\Buttons\LeftTriggerButton");

            plankPosition.X = (backgroundTexture.Width * ScaledVector2.DrawFactor) / 2 -
                              (plankTexture.Width * ScaledVector2.DrawFactor) / 2;
            plankPosition.Y = 60 * ScaledVector2.ScaleFactor;


            rightTriggerPosition.X = 900 * ScaledVector2.ScaleFactor;
            rightTriggerPosition.Y = 50 * ScaledVector2.ScaleFactor;

            leftTriggerPosition.X = 320 * ScaledVector2.ScaleFactor;
            leftTriggerPosition.Y = 50 * ScaledVector2.ScaleFactor;

            base.LoadContent();
        }
Exemplo n.º 12
0
        /// <summary>
        /// Draws the screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            ItemPositionMapping.Clear();
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            spriteBatch.Draw(backgroundTexture, backgroundPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            spriteBatch.Draw(plankTexture, plankPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            spriteBatch.Draw(lineBorderTexture, lineBorderPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            spriteBatch.Draw(backTexture, backPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            string  text         = "Back";
            Vector2 textPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, text,
                                                                   new Rectangle((int)backPosition.X, (int)backPosition.Y,
                                                                                 backTexture.Width, backTexture.Height));

            spriteBatch.DrawString(Fonts.ButtonNamesFont, text, textPosition, Color.White);

            spriteBatch.DrawString(Fonts.HeaderFont,
                                   (mode == SaveLoadScreenMode.Load ? "Load" : "Save"),
                                   titleTextPosition, Fonts.TitleColor);

            if ((Session.SaveGameDescriptions != null))
            {
                for (int i = 0; i < Session.SaveGameDescriptions.Count; i++)
                {
                    Vector2 descriptionTextPosition = ScaledVector2.GetScaledVector(295f,
                                                                                    200f + i * (Fonts.GearInfoFont.LineSpacing + 80f));
                    ItemPositionMapping.Add(new Rectangle((int)descriptionTextPosition.X - 80,
                                                          (int)descriptionTextPosition.Y - 25, 600, 75), i);
                    Color descriptionTextColor = Color.Black;

                    // if the save game is selected, draw the highlight color
                    if (i == currentSlot)
                    {
                        descriptionTextColor = Fonts.HighlightColor;
                        spriteBatch.Draw(highlightTexture,
                                         descriptionTextPosition + ScaledVector2.GetScaledVector(-100, -23), null,
                                         Color.White, 0f,
                                         Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
                        spriteBatch.Draw(arrowTexture,
                                         descriptionTextPosition + ScaledVector2.GetScaledVector(-75, -15), null,
                                         Color.White, 0f,
                                         Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

                        spriteBatch.Draw(deleteTexture, deletePosition, null, Color.White, 0f,
                                         Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

                        string  deleteText         = "Delete";
                        Vector2 deleteFontPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, deleteText,
                                                                                     new Rectangle((int)deletePosition.X, (int)deletePosition.Y,
                                                                                                   deleteTexture.Width, deleteTexture.Height));

                        spriteBatch.DrawString(Fonts.ButtonNamesFont, deleteText, deleteFontPosition, Color.White);

                        spriteBatch.Draw(selectTexture, selectPosition, null, Color.White, 0f,
                                         Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

                        string  selectText         = "Select";
                        Vector2 selectFontPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, selectText,
                                                                                     new Rectangle((int)selectPosition.X, (int)selectPosition.Y,
                                                                                                   selectTexture.Width, selectTexture.Height));

                        spriteBatch.DrawString(Fonts.ButtonNamesFont, selectText, selectFontPosition, Color.White);
                    }

                    spriteBatch.DrawString(Fonts.GearInfoFont,
                                           Session.SaveGameDescriptions[i].ChapterName,
                                           descriptionTextPosition, descriptionTextColor);
                    descriptionTextPosition.X = 650 * ScaledVector2.ScaleFactor;
                    spriteBatch.DrawString(Fonts.GearInfoFont,
                                           Session.SaveGameDescriptions[i].Description,
                                           descriptionTextPosition, descriptionTextColor);
                }

                // if there is space for one, add an empty entry
                if ((mode == SaveLoadScreenMode.Save) &&
                    (Session.SaveGameDescriptions.Count <
                     Session.MaximumSaveGameDescriptions))
                {
                    int     i = Session.SaveGameDescriptions.Count;
                    Vector2 descriptionTextPosition = ScaledVector2.GetScaledVector(
                        295f,
                        200f + i * (Fonts.GearInfoFont.LineSpacing + 80f));
                    Color descriptionTextColor = Color.Black;

                    // if the save game is selected, draw the highlight color
                    if (i == currentSlot)
                    {
                        descriptionTextColor = Fonts.HighlightColor;
                        spriteBatch.Draw(highlightTexture,
                                         descriptionTextPosition + ScaledVector2.GetScaledVector(-100, -23), null,
                                         Color.White, 0f,
                                         Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
                        spriteBatch.Draw(arrowTexture,
                                         descriptionTextPosition + ScaledVector2.GetScaledVector(-75, -15), null,
                                         Color.White, 0f,
                                         Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
                        spriteBatch.Draw(selectTexture, selectPosition, null, Color.White, 0f,
                                         Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

                        string  selectText         = "Select";
                        Vector2 selectFontPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, selectText,
                                                                                     new Rectangle((int)selectPosition.X, (int)selectPosition.Y,
                                                                                                   selectTexture.Width, selectTexture.Height));

                        spriteBatch.DrawString(Fonts.ButtonNamesFont, selectText,
                                               selectFontPosition, Color.White);
                    }

                    ItemPositionMapping.Add(new Rectangle((int)descriptionTextPosition.X - 80,
                                                          (int)descriptionTextPosition.Y - 25, 600, 75), i);
                    spriteBatch.DrawString(Fonts.GearInfoFont, "-------empty------",
                                           descriptionTextPosition, descriptionTextColor);
                    descriptionTextPosition.X = 650 * ScaledVector2.ScaleFactor;
                    spriteBatch.DrawString(Fonts.GearInfoFont, "-----",
                                           descriptionTextPosition, descriptionTextColor);
                }
            }

            // if there are no slots to load, report that
            if (Session.SaveGameDescriptions == null)
            {
                spriteBatch.DrawString(Fonts.GearInfoFont,
                                       "No Storage Device Available",
                                       ScaledVector2.GetScaledVector(295f, 200f), Color.Black);
            }
            else if ((mode == SaveLoadScreenMode.Load) &&
                     (Session.SaveGameDescriptions.Count <= 0))
            {
                spriteBatch.DrawString(Fonts.GearInfoFont,
                                       "No Save Games Available",
                                       ScaledVector2.GetScaledVector(295f, 200f), Color.Black);
            }


            spriteBatch.End();
        }
Exemplo n.º 13
0
        /// <summary>
        /// draws the dialog.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            Vector2 textPosition = dialogueStartPosition;

            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            // draw the fading screen
            spriteBatch.Draw(fadeTexture, ScaledVector2.GetScaledVector(1280, 720), null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            // draw popup background
            spriteBatch.Draw(backgroundTexture, backgroundPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            // draw the top line
            spriteBatch.Draw(lineTexture, topLinePosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            // draw the bottom line
            spriteBatch.Draw(lineTexture, bottomLinePosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            // draw scrollbar
            spriteBatch.Draw(scrollTexture, scrollPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            // draw title
            spriteBatch.DrawString(Fonts.HeaderFont, titleText, titlePosition,
                                   Fonts.CountColor);

            // draw the dialogue
            for (int i = startIndex; i < endIndex; i++)
            {
                spriteBatch.DrawString(Fonts.DescriptionFont, dialogueList[i],
                                       textPosition, Fonts.CountColor);
                textPosition.Y += Fonts.DescriptionFont.LineSpacing;
            }

            // draw the Back button and adjoining text
            if (!String.IsNullOrEmpty(backText))
            {
                Vector2 backTextPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, backText,
                                                                           new Rectangle((int)backButtonPosition.X, (int)backButtonPosition.Y,
                                                                                         backButtonTexture.Width, backButtonTexture.Height));

                spriteBatch.Draw(backButtonTexture, backButtonPosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

                spriteBatch.DrawString(Fonts.ButtonNamesFont, backText, backTextPosition,
                                       Color.White);
            }

            // draw the Select button and adjoining text
            if (!String.IsNullOrEmpty(selectText))
            {
                selectPosition.X = selectButtonPosition.X -
                                   Fonts.ButtonNamesFont.MeasureString(selectText).X - 10f;
                selectPosition.Y = selectButtonPosition.Y;

                Vector2 selectTextPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, selectText,
                                                                             new Rectangle((int)selectButtonPosition.X, (int)selectButtonPosition.Y,
                                                                                           selectButtonTexture.Width, selectButtonTexture.Height));

                spriteBatch.Draw(selectButtonTexture, selectButtonPosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

                spriteBatch.DrawString(Fonts.ButtonNamesFont, selectText, selectTextPosition,
                                       Color.White);
            }

            spriteBatch.End();
        }