コード例 #1
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            Fonts.LoadContent(Content);

            base.LoadContent();
        }
コード例 #2
0
        /// <summary>
        /// UnloadContent will be called once per game and is the place to unload
        /// all content.
        /// </summary>
        protected override void UnloadContent()
        {
            Fonts.UnloadContent();

            base.UnloadContent();
        }
コード例 #3
0
 public HelpScreen()
     : base()
 {
     textLines = Fonts.BreakTextIntoList(helpText, Fonts.DescriptionFont,
                                         (int)(590 * ScaledVector2.ScaleFactor));
 }
コード例 #4
0
        /// <summary>
        /// Get the quest requirements
        /// </summary>
        /// <param name="quest">The particular quest</param>
        /// <returns>List of strings containing formatted output</returns>
        private List <Line> GetRequirements(Quest quest)
        {
            List <Line>   reqdList;
            Line          reqd;
            int           currentCount = 0;
            int           totalCount   = 0;
            List <string> dialog;

            reqdList  = new List <Line>();
            reqd.font = Fonts.DescriptionFont;

            // Add Monster Requirements
            if (quest.MonsterRequirements.Count > 0)
            {
                reqd.color = headerColor;
                reqd.text  = String.Empty;
                reqdList.Add(reqd);
                reqd.text = "Monster Progress";
                reqdList.Add(reqd);

                for (int i = 0; i < quest.MonsterRequirements.Count; i++)
                {
                    reqd.color   = textColor;
                    currentCount = quest.MonsterRequirements[i].CompletedCount;
                    totalCount   = quest.MonsterRequirements[i].Count;
                    Monster monster = quest.MonsterRequirements[i].Content;
                    reqd.text = monster.Name + " = " + currentCount + " / " +
                                totalCount;

                    if (currentCount == totalCount)
                    {
                        reqd.color = Color.Red;
                    }
                    reqdList.Add(reqd);
                }
            }

            // Add Item Requirements
            if (quest.GearRequirements.Count > 0)
            {
                reqd.color = headerColor;
                reqd.text  = String.Empty;
                reqdList.Add(reqd);
                reqd.text = "Item Progress";
                reqdList.Add(reqd);

                for (int i = 0; i < quest.GearRequirements.Count; i++)
                {
                    reqd.color   = textColor;
                    currentCount = quest.GearRequirements[i].CompletedCount;
                    totalCount   = quest.GearRequirements[i].Count;
                    Gear gear = quest.GearRequirements[i].Content;
                    reqd.text = gear.Name + " = " + currentCount + " / " + totalCount;
                    if (currentCount == totalCount)
                    {
                        reqd.color = Color.Red;
                    }
                    reqdList.Add(reqd);
                }
            }

            // Add Current Objective
            reqd.color = headerColor;
            reqd.text  = String.Empty;
            reqdList.Add(reqd);
            reqd.text = "Current Objective";
            reqdList.Add(reqd);
            reqd.color = textColor;

            switch (quest.Stage)
            {
            case Quest.QuestStage.InProgress:
                dialog = Fonts.BreakTextIntoList(quest.ObjectiveMessage,
                                                 Fonts.DescriptionFont, 715);
                for (int i = 0; i < dialog.Count; i++)
                {
                    reqd.text = dialog[i];
                    reqdList.Add(reqd);
                }
                break;

            case Quest.QuestStage.RequirementsMet:
                dialog = Fonts.BreakTextIntoList(quest.DestinationObjectiveMessage,
                                                 Fonts.DescriptionFont, 715);
                for (int i = 0; i < dialog.Count; i++)
                {
                    reqd.text = dialog[i];
                    reqdList.Add(reqd);
                }
                break;

            case Quest.QuestStage.Completed:
                reqd.font  = Fonts.ButtonNamesFont;
                reqd.color = new Color(139, 21, 73);
                reqd.text  = "Quest Completed";
                reqdList.Add(reqd);
                break;
            }

            return(reqdList);
        }
コード例 #5
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();
        }
コード例 #6
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();
        }
コード例 #7
0
 public HelpScreen()
     : base()
 {
     textLines = Fonts.BreakTextIntoList(helpText, Fonts.DescriptionFont, 590);
 }
コード例 #8
0
        /// <summary>
        ///  Draw the screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            Vector2 currentIconPosition = iconPosition;
            Vector2 currentTextPosition = textPosition;
            Vector2 currentlinePosition = linePosition;

            switch (mode)
            {
            case RewardScreenMode.Quest:
                titleText = "Quest Complete";
                break;

            case RewardScreenMode.Combat:
                titleText = "Combat Won";
                break;
            }
            titlePosition.X = (screenSize.X -
                               Fonts.HeaderFont.MeasureString(titleText).X) / 2;
            titlePosition.Y = backgroundPosition.Y + lineSpacing;

            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            // Draw the fading screen
            spriteBatch.Draw(fadeTexture, new Vector2(ScreenManager.GraphicsDevice.Viewport.Width,
                                                      ScreenManager.GraphicsDevice.Viewport.Height), null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

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

            // Draw the title
            spriteBatch.DrawString(Fonts.HeaderFont, titleText, titlePosition,
                                   Fonts.TitleColor);

            // Draw the experience points awarded
            spriteBatch.DrawString(Fonts.GearInfoFont,
                                   "XP Awarded :        " + experienceReward,
                                   xpAwardPosition, Fonts.CountColor);

            // Draw the gold points awarded
            spriteBatch.DrawString(Fonts.GearInfoFont,
                                   "Gold Awarded :      " + Fonts.GetGoldString(goldReward),
                                   goldAwardPosition, Fonts.CountColor);

            // Draw the items awarded
            spriteBatch.DrawString(Fonts.GearInfoFont, "Items Awarded :",
                                   itemAwardPosition, Fonts.CountColor);

            // Draw horizontal divider lines
            for (int i = 0; i <= maxLines; i++)
            {
                spriteBatch.Draw(lineTexture, currentlinePosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
                currentlinePosition.Y += lineSpacing;
            }

            // Draw the item details
            for (int i = startIndex; i < endIndex; i++)
            {
                // Draw the item icon
                gearReward[i].DrawIcon(ScreenManager.SpriteBatch, currentIconPosition);

                // Draw the item name
                spriteBatch.DrawString(Fonts.GearInfoFont,
                                       gearReward[i].Name, currentTextPosition, Fonts.CountColor);

                // Increment the position to the next line
                currentTextPosition.Y += lineSpacing;
                currentIconPosition.Y += lineSpacing;
            }
            // Draw the scroll buttons
            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);

            // Draw the select button and its corresponding text
            spriteBatch.Draw(selectIconTexture, selectIconPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            Vector2 selectFontPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, selectString,
                                                                         new Rectangle((int)selectIconPosition.X, (int)selectIconPosition.Y,
                                                                                       selectIconTexture.Width, selectIconTexture.Height));


            spriteBatch.DrawString(Fonts.ButtonNamesFont, selectString, selectFontPosition,
                                   Color.White);
            spriteBatch.End();
        }
コード例 #9
0
        /// <summary>
        /// Draw all of the buttons used by the screen.
        /// </summary>
        protected virtual void DrawButtons()
        {
            if (!IsActive)
            {
                return;
            }

            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            // draw the left trigger texture and text
            if ((leftTriggerTexture != null) && !String.IsNullOrEmpty(leftTriggerText))
            {
                Vector2 position = leftTriggerTexturePosition + new Vector2(
                    leftTriggerTexture.Width / 2f - (float)Math.Ceiling(
                        Fonts.PlayerStatisticsFont.MeasureString(leftTriggerText).X / 2f),
                    60f * ScaledVector2.ScaleFactor);
            }

            // draw the right trigger texture and text
            if ((rightTriggerTexture != null) && !String.IsNullOrEmpty(rightTriggerText))
            {
                Vector2 position = rightTriggerTexturePosition + new Vector2(
                    rightTriggerTexture.Width / 2f - (float)Math.Ceiling(
                        Fonts.PlayerStatisticsFont.MeasureString(rightTriggerText).X / 2f),
                    60f * ScaledVector2.ScaleFactor);
            }

            // draw the left trigger texture and text
            if ((backButtonTexture != null) && !String.IsNullOrEmpty(backButtonText))
            {
                spriteBatch.Draw(backButtonTexture, backButtonTexturePosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

                Vector2 backPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, backButtonText,
                                                                       new Rectangle((int)backButtonTexturePosition.X, (int)backButtonTexturePosition.Y,
                                                                                     backButtonTexture.Width, backButtonTexture.Height));
                spriteBatch.DrawString(Fonts.ButtonNamesFont, backButtonText,
                                       backPosition, Color.White);
            }

            // draw the left trigger texture and text
            if ((selectButtonTexture != null) && !String.IsNullOrEmpty(selectButtonText))
            {
                spriteBatch.Draw(selectButtonTexture, selectButtonTexturePosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);


                Vector2 selectPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, selectButtonText,
                                                                         new Rectangle((int)selectButtonTexturePosition.X, (int)selectButtonTexturePosition.Y,
                                                                                       selectButtonTexture.Width, selectButtonTexture.Height));
                spriteBatch.DrawString(Fonts.ButtonNamesFont, selectButtonText,
                                       selectPosition, Color.White);
            }

            // draw the left trigger texture and text
            if ((xButtonTexture != null) && !String.IsNullOrEmpty(xButtonText))
            {
                spriteBatch.Draw(xButtonTexture, xButtonTexturePosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);


                Vector2 xPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, xButtonText,
                                                                    new Rectangle((int)xButtonTexturePosition.X, (int)xButtonTexturePosition.Y,
                                                                                  xButtonTexture.Width, xButtonTexture.Height));
                spriteBatch.DrawString(Fonts.ButtonNamesFont, xButtonText,
                                       xPosition, Color.White);
            }

            // draw the left trigger texture and text
            if ((yButtonTexture != null) && !String.IsNullOrEmpty(yButtonText))
            {
                spriteBatch.Draw(yButtonTexture, yButtonTexturePosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);


                Vector2 yPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, yButtonText,
                                                                    new Rectangle((int)yButtonTexturePosition.X, (int)yButtonTexturePosition.Y,
                                                                                  yButtonTexture.Width, yButtonTexture.Height));

                spriteBatch.DrawString(Fonts.ButtonNamesFont, yButtonText,
                                       yPosition, Color.White);
            }
        }
コード例 #10
0
        /// <summary>
        /// Draw the screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            Vector2 currentTextPosition  = textPosition;
            Vector2 currentIconPosition  = iconPosition;
            Vector2 currentLinePosition  = linePosition;
            Vector2 currentLevelPosition = levelPosition;

            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            spriteBatch.Begin();

            // Draw the fading screen
            spriteBatch.Draw(fadeTexture, new Rectangle(0, 0,
                                                        ScreenManager.GraphicsDevice.Viewport.Width,
                                                        ScreenManager.GraphicsDevice.Viewport.Height), Color.White);

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

            // Draw the title
            spriteBatch.DrawString(Fonts.HeaderFont, titleText, titlePosition,
                                   Fonts.TitleColor);

            DrawPlayerStats();

            // Draw the spell upgrades caption
            spriteBatch.Draw(headerTexture, headerPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            spriteBatch.DrawString(Fonts.PlayerNameFont, "Spell Upgrades",
                                   spellUpgradePosition, colorClass);

            // Draw the horizontal separating lines
            for (int i = 0; i <= maxLines - 1; i++)
            {
                currentLinePosition.Y += lineSpacing;
                spriteBatch.Draw(lineTexture, currentLinePosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            }

            // Draw the spell upgrade details
            for (int i = startIndex; i < endIndex; i++)
            {
                // Draw the spell icon
                spriteBatch.Draw(spellList[i].IconTexture, currentIconPosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

                // Draw the spell name
                spriteBatch.DrawString(Fonts.GearInfoFont, spellList[i].Name,
                                       currentTextPosition, Fonts.CountColor);

                // Draw the spell level
                spriteBatch.DrawString(Fonts.GearInfoFont, "Spell Level " +
                                       spellList[i].Level.ToString(),
                                       currentLevelPosition, Fonts.CountColor);

                // Increment to next line position
                currentTextPosition.Y  += lineSpacing;
                currentLevelPosition.Y += lineSpacing;
                currentIconPosition.Y  += lineSpacing;
            }

            // Draw the scroll bars
            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);

            // Draw the select button and its corresponding text
            spriteBatch.Draw(selectIconTexture, selectIconPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            Vector2 selectTextPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, selectString,
                                                                         new Rectangle((int)selectIconPosition.X, (int)selectIconPosition.Y,
                                                                                       selectIconTexture.Width, selectIconTexture.Height));

            spriteBatch.DrawString(Fonts.ButtonNamesFont, selectString, selectTextPosition, Color.White);
            spriteBatch.End();
        }
コード例 #11
0
ファイル: InnScreen.cs プロジェクト: nusisschad/XNAGameStudio
        /// <summary>
        /// Draw the screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            SpriteBatch spriteBatch    = ScreenManager.SpriteBatch;
            Vector2     dialogPosition = informationPosition;

            spriteBatch.Begin();

            // Draw fade screen
            spriteBatch.Draw(fadeTexture, screenRectangle, Color.White);

            // Draw the background
            spriteBatch.Draw(backgroundTexture, backgroundPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            // Draw the wooden plank
            spriteBatch.Draw(plankTexture, plankPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            // Draw the inn name on the wooden plank
            spriteBatch.DrawString(Fonts.HeaderFont, inn.Name, namePosition,
                                   Fonts.DisplayColor);

            // Draw the stay and leave option texts based on the current selection
            if (selectionMark == 1)
            {
                spriteBatch.Draw(highlightTexture, stayHighlightPosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
                spriteBatch.Draw(arrowTexture, stayArrowPosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
                spriteBatch.DrawString(
                    Fonts.GearInfoFont, stayString, stayPosition, Fonts.HighlightColor,
                    0f, Vector2.Zero, 1.5f, SpriteEffects.None, 0f);
                spriteBatch.DrawString(
                    Fonts.GearInfoFont, leaveString, leavePosition, Fonts.DisplayColor,
                    0f, Vector2.Zero, 1.5f, SpriteEffects.None, 0f);
            }
            else
            {
                spriteBatch.Draw(highlightTexture, leaveHighlightPosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
                spriteBatch.Draw(arrowTexture, leaveArrowPosition, null, Color.White, 0f,
                                 Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
                spriteBatch.DrawString(Fonts.GearInfoFont, stayString, stayPosition,
                                       Fonts.DisplayColor, 0f, Vector2.Zero, 1.5f, SpriteEffects.None, 0f);
                spriteBatch.DrawString(Fonts.GearInfoFont, leaveString, leavePosition,
                                       Fonts.HighlightColor, 0f, Vector2.Zero, 1.5f, SpriteEffects.None, 0f);
            }
            // Draw the amount of gold
            spriteBatch.DrawString(Fonts.ButtonNamesFont,
                                   Fonts.GetGoldString(Session.Party.PartyGold), goldStringPosition,
                                   Color.White);

            // Draw Conversation Strip
            spriteBatch.Draw(conversationTexture, conversationStripPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            // Draw Shop Keeper
            spriteBatch.Draw(inn.ShopkeeperTexture, innKeeperPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);
            // Draw the cost to stay
            costString = "Cost: " + GetChargeForParty(Session.Party) + " Gold";
            spriteBatch.DrawString(Fonts.DescriptionFont, costString, costPosition,
                                   Color.DarkRed);
            // Draw the innkeeper dialog
            for (int i = 0; i < endIndex; i++)
            {
                spriteBatch.DrawString(Fonts.DescriptionFont, currentDialogue[i],
                                       dialogPosition, Color.Black);
                dialogPosition.Y += Fonts.DescriptionFont.LineSpacing;
            }

            // Draw Gold Icon
            spriteBatch.Draw(goldIcon, goldIconPosition, null, Color.White, 0f,
                             Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f);

            spriteBatch.End();
        }