/// <summary> /// Draws the screen. /// </summary> public override void Draw(GameTime gameTime) { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(); // Draw fading screen spriteBatch.Draw(fadeTexture, new Rectangle(0, 0, 1280, 720), Color.White); // Draw popup texture spriteBatch.Draw(backTexture, backgroundPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); // Draw title spriteBatch.DrawString(Fonts.HeaderFont, titleString, titlePosition, Fonts.TitleColor); // Draw Gameover text spriteBatch.DrawString(Fonts.ButtonNamesFont, gameOverString, gameOverPosition, Fonts.CountColor); 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(); }
/// <summary> /// Draw the screen /// </summary> public override void Draw(GameTime gameTime) { Vector2 dialoguePosition = textPosition; SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(); // Draw the fading screen spriteBatch.Draw(fadeTexture, new Vector2(fadeDest.X, fadeDest.Y), null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); // Draw the 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 the scrollbar spriteBatch.Draw(scrollTexture, scrollPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); // Draw the Back button spriteBatch.Draw(backIconTexture, backIconPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); string backFontText = "Back"; Vector2 backFontPositon = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, backFontText, new Rectangle((int)backIconPosition.X, (int)backIconPosition.Y, backIconTexture.Width, backIconTexture.Height)); spriteBatch.DrawString(Fonts.ButtonNamesFont, backFontText, backFontPositon, Color.White); // Draw the title spriteBatch.DrawString(Fonts.HeaderFont, titleString, titlePosition, Fonts.TitleColor); //Draw the information dialog for (int i = startIndex; i < endIndex; i++) { dialoguePosition.X = (int)((screenSize.X - currentDialogue[i].font.MeasureString( currentDialogue[i].text).X) / 2) - 20; spriteBatch.DrawString(currentDialogue[i].font, currentDialogue[i].text, dialoguePosition, currentDialogue[i].color); dialoguePosition.Y += currentDialogue[i].font.LineSpacing; } spriteBatch.End(); }
/// <summary> /// Draw Select and Drop Button /// </summary> private void DrawButtons() { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; string selectText; if (usedGear == null) { selectText = "Use"; } else if (usedGear is Item) { selectText = "Use"; } else { selectText = "Equip"; } if (CombatEngine.IsActive) { if (selectionMark != -1) { isUseAllowed = true; } } if (isUseAllowed && !isGearUsed) { // Draw Select Button spriteBatch.Draw(selectButton, selectButtonPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); // Display Text //position = selectButtonPosition; //placeTextMid = Fonts.ButtonNamesFont.MeasureString(selectText); //position.X -= placeTextMid.X + 10 * ScaledVector2.ScaleFactor; Vector2 selectTextPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, selectText, new Rectangle((int)selectButtonPosition.X, (int)selectButtonPosition.Y, selectButton.Width, selectButton.Height)); spriteBatch.DrawString(Fonts.ButtonNamesFont, selectText, selectTextPosition, Color.White); } // Draw Back Button spriteBatch.Draw(backButton, backButtonPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); // Display Back Text //position = backButtonPosition; //position.X += (backButton.Width * ScaledVector2.DrawFactor) + (10 * ScaledVector2.ScaleFactor); string backText = "Back"; Vector2 backTextPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, backText, new Rectangle((int)backButtonPosition.X, (int)backButtonPosition.Y, backButton.Width, backButton.Height)); spriteBatch.DrawString(Fonts.ButtonNamesFont, backText, backTextPosition, Color.White); }
/// <summary> /// D /// </summary> private void DrawButtons() { if (!IsActive) { return; } SpriteBatch spriteBatch = ScreenManager.SpriteBatch; // Back Button spriteBatch.Draw(backButton, backButtonPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); spriteBatch.Draw(selectButton, selectButtonPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); string spellText = "Spellbook"; Vector2 spellPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, spellText, new Rectangle((int)selectButtonPosition.X, (int)selectButtonPosition.Y, selectButton.Width, selectButton.Height)); spellRecangle = new Rectangle((int)selectButtonPosition.X, (int)selectButtonPosition.Y, selectButton.Width, selectButton.Height); spriteBatch.DrawString(Fonts.ButtonNamesFont, spellText, spellPosition, Color.White); string backText = "Back"; Vector2 backPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, backText, new Rectangle((int)backButtonPosition.X, (int)backButtonPosition.Y, backButton.Width, backButton.Height)); spriteBatch.DrawString(Fonts.ButtonNamesFont, backText, backPosition, Color.White); // Draw drop Button spriteBatch.Draw(dropButton, dropButtonPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); string equipmentText = "Equipment"; equipmentRecangle = new Rectangle((int)dropButtonPosition.X, (int)dropButtonPosition.Y, dropButton.Width, dropButton.Height); Vector2 equipmentPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, equipmentText, equipmentRecangle); spriteBatch.DrawString(Fonts.ButtonNamesFont, equipmentText, equipmentPosition, Color.White); // Draw Gold Icon spriteBatch.Draw(goldIcon, goldIconPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); }
/// <summary> /// Draw this screen. /// </summary> public override void Draw(GameTime gameTime) { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(); // draw the background images spriteBatch.Draw(backgroundTexture, backgroundPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); spriteBatch.Draw(descriptionAreaTexture, descriptionAreaPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); spriteBatch.Draw(iconTexture, iconPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); // Draw each menu entry in turn. for (int i = 0; i < MenuEntries.Count; i++) { MenuEntry menuEntry = MenuEntries[i]; bool isSelected = IsActive && (i == selectedEntry); menuEntry.Draw(this, isSelected, gameTime); } // draw the description text for the selected entry MenuEntry selectedMenuEntry = SelectedMenuEntry; if ((selectedMenuEntry != null) && !String.IsNullOrEmpty(selectedMenuEntry.Description)) { Vector2 textSize = Fonts.DescriptionFont.MeasureString(selectedMenuEntry.Description); Vector2 textPosition2 = descriptionAreaTextPosition + new Vector2( (float)Math.Floor((descriptionAreaTexture.Width - textSize.X) / 2), 0f); } // if we are in-game, draw the back instruction if (Session.IsActive) { spriteBatch.Draw(backTexture, backPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); string text = "Resume"; 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.End(); }
/// <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(); }
/// <summary> /// Draws the message box. /// </summary> public override void Draw(GameTime gameTime) { SpriteBatch spriteBatch = ScreenManager.SpriteBatch; spriteBatch.Begin(); var position = new Vector2(loadingBlackTextureDestination.X, loadingBlackTextureDestination.Y); spriteBatch.Draw(loadingBlackTexture, position, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); spriteBatch.Draw(backgroundTexture, backgroundPosition, 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(selectTexture, selectPosition, null, Color.White, 0f, Vector2.Zero, ScaledVector2.DrawFactor, SpriteEffects.None, 0f); string noText = "No"; Vector2 noTextPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, noText, new Rectangle((int)backPosition.X, (int)backPosition.Y, (int)(backTexture.Width), (int)(backTexture.Height))); spriteBatch.DrawString(Fonts.ButtonNamesFont, noText, noTextPosition, Color.White); string yesText = "Yes"; Vector2 yesTextPosition = Fonts.GetCenterPositionInButton(Fonts.ButtonNamesFont, yesText, new Rectangle((int)selectPosition.X, (int)selectPosition.Y, (int)(selectTexture.Width), (int)(selectTexture.Height))); spriteBatch.DrawString(Fonts.ButtonNamesFont, yesText, yesTextPosition, Color.White); spriteBatch.DrawString(Fonts.HeaderFont, "Confirmation", confirmPosition, Fonts.CountColor); spriteBatch.DrawString(Fonts.GearInfoFont, message, messagePosition, Fonts.CountColor); spriteBatch.End(); }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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); } }
/// <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(); }