Esempio n. 1
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     foreach (GridEntity tile in menuBackground)
     {
         tile.Draw(spriteBatch);
     }
     title.Draw(spriteBatch);
     newGameButton.Draw(spriteBatch);
     loadGameButton.Draw(spriteBatch);
     sandboxButton.Draw(spriteBatch);
     adventureButton.Draw(spriteBatch);
 }
Esempio n. 2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            MouseState mouse = Mouse.GetState();

            background.Draw(spriteBatch, new Rectangle(0, 0, GameConstants.WINDOW_WIDTH, GameConstants.WINDOW_HEIGHT));

            if (fileSelected != -1)
            {
                if (confirmButton.CollisionRectangle.Contains(mouse.Position))
                {
                    confirmButton.Draw(spriteBatch, Color.LightBlue);
                }
                else
                {
                    confirmButton.Draw(spriteBatch);
                }
            }

            foreach (StaticEntity button in fileButtons)
            {
                if (fileButtons.IndexOf(button) == fileSelected)
                {
                    button.Draw(spriteBatch, Color.SteelBlue);
                }
                else if (button.CollisionRectangle.Contains(mouse.Position))
                {
                    button.Draw(spriteBatch, Color.LightBlue);
                }
                else
                {
                    button.Draw(spriteBatch);
                }
            }

            for (int i = 0; i < levelData.Count; i++)
            {
                spriteBatch.DrawString(font, levelData.ElementAt(i), new Vector2(GameConstants.TILE_SIZE * 3.1f, GameConstants.TILE_SIZE * 2.7f + GameConstants.TILE_SIZE * 2 * i), Color.Black);
            }
            foreach (ItemBox box in weapon1ItemBoxes)
            {
                if (box.IsActive)
                {
                    box.Draw(spriteBatch);
                }
            }
            foreach (ItemBox box in weapon2ItemBoxes)
            {
                if (box.IsActive)
                {
                    box.Draw(spriteBatch);
                }
            }
            foreach (ItemBox box in shield1ItemBoxes)
            {
                if (box.IsActive)
                {
                    box.Draw(spriteBatch);
                }
            }
            foreach (ItemBox box in charm1ItemBoxes)
            {
                if (box.IsActive)
                {
                    box.Draw(spriteBatch);
                }
            }

            spriteBatch.DrawString(font20, "Load Game", new Vector2(GameConstants.TILE_SIZE, GameConstants.TILE_SIZE), Color.Black);

            if (backButton.CollisionRectangle.Contains(mouse.Position))
            {
                backButton.Draw(spriteBatch, Color.LightBlue);
            }
            else
            {
                backButton.Draw(spriteBatch);
            }
        }
Esempio n. 3
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            MouseState mouse = Mouse.GetState();

            background.Draw(spriteBatch, new Rectangle(0, 0, GameConstants.WINDOW_WIDTH, GameConstants.WINDOW_HEIGHT));

            #region Item Boxes
            foreach (StaticEntity equipItemBoxBackground in equippedItemBoxBackgrounds)
            {
                equipItemBoxBackground.Draw(spriteBatch, Color.DimGray);
            }

            foreach (ItemBox itemBox in equippedItemBoxes)
            {
                if (itemBox.Sprite != null)
                {
                    if (itemBox.IsHovered)
                    {
                        itemBox.Draw(spriteBatch, Color.LightSteelBlue);
                    }
                    else
                    {
                        itemBox.Draw(spriteBatch);
                    }
                }
            }
            #endregion

            #region Tooltip text
            if (hoveredItemName != "")
            {
                spriteBatch.DrawString(font, hoveredItemName, new Vector2(GameConstants.TILE_SIZE, GameConstants.TILE_SIZE * 7), Color.Black);

                spriteBatch.DrawString(font, hoveredItemType, new Vector2(GameConstants.TILE_SIZE, GameConstants.TILE_SIZE * 7 + font.LineSpacing), Color.Black);

                if (hoveredItemDamage != "")
                {
                    spriteBatch.DrawString(font, "Damage: " + hoveredItemDamage, new Vector2(GameConstants.TILE_SIZE, GameConstants.TILE_SIZE * 7 + font.LineSpacing * 2), Color.Black);
                }

                spriteBatch.DrawString(font, "Effects: " + hoveredItemEffects, new Vector2(GameConstants.TILE_SIZE, GameConstants.TILE_SIZE * 7 + font.LineSpacing * 3), Color.Black);
                if (hoveredItemCooldown != "")
                {
                    spriteBatch.DrawString(font, "Cooldown: " + hoveredItemCooldown + " second(s)", new Vector2(GameConstants.TILE_SIZE, GameConstants.TILE_SIZE * 7 + font.LineSpacing * 4), Color.Black);
                }
                spriteBatch.DrawString(font, hoveredItemTooltip, new Vector2(GameConstants.TILE_SIZE, GameConstants.TILE_SIZE * 7 + font.LineSpacing * 5), Color.Black);
            }
            #endregion

            if (playButton.CollisionRectangle.Contains(mouse.Position))
            {
                playButton.Draw(spriteBatch, Color.LightSteelBlue);
            }
            else
            {
                playButton.Draw(spriteBatch);
            }

            #region Text
            spriteBatch.DrawString(font, "The arena allows you to choose one item to take from your defeated foes.", new Vector2(GameConstants.TILE_SIZE / 2, GameConstants.TILE_SIZE / 2), Color.Black);
            spriteBatch.DrawString(font, "If you are injured, you may choose to take a healing potion instead.", new Vector2(GameConstants.TILE_SIZE / 2, GameConstants.TILE_SIZE / 2 + font.LineSpacing), Color.Black);
            spriteBatch.DrawString(font, "Left click on a piece of equipment to select it. Right click if you'd like to equip a weapon in slot 2.", new Vector2(GameConstants.TILE_SIZE / 2, GameConstants.TILE_SIZE / 2 + font.LineSpacing * 3), Color.Black);
            Color healTextColor = Color.Black;
            if (oldCharm1.Type == CharmType.Lifesteal)
            {
                healTextColor = Color.Crimson;
            }
            spriteBatch.DrawString(font, "Heal", new Vector2(GameConstants.TILE_SIZE * 7 + (GameConstants.TILE_SIZE - font.MeasureString("Heal").X) / 2, GameConstants.TILE_SIZE * 3 - (GameConstants.TILE_SIZE / 2 + font.LineSpacing)), healTextColor);
            spriteBatch.DrawString(font, "Undo", new Vector2(GameConstants.TILE_SIZE * 9 + (GameConstants.TILE_SIZE - font.MeasureString("Undo").X) / 2, GameConstants.TILE_SIZE * 3 - (GameConstants.TILE_SIZE / 2 + font.LineSpacing)), Color.Black);
            spriteBatch.DrawString(font, "Level: " + level.ToString(), new Vector2(GameConstants.WINDOW_WIDTH - font.MeasureString("Level:     ").X, 0), Color.Black);

            #endregion

            #region Item boxes
            foreach (StaticEntity itemBoxBackground in tradeItemBoxBackgrounds)
            {
                itemBoxBackground.Draw(spriteBatch, Color.DimGray);
            }

            foreach (ItemBox itemBox in tradeItemBoxes)
            {
                if (itemBox.Sprite != null && itemBox.IsActive)
                {
                    if (itemBox.IsHovered)
                    {
                        itemBox.Draw(spriteBatch, Color.LightSteelBlue);
                    }
                    else
                    {
                        itemBox.Draw(spriteBatch);
                    }
                }
            }

            #endregion

            #region Buttons

            if (resetButton.CollisionRectangle.Contains(mouse.Position))
            {
                resetButton.Draw(spriteBatch, Color.LightSteelBlue);
            }
            else
            {
                resetButton.Draw(spriteBatch);
            }

            if (oldCharm1.Type == CharmType.Lifesteal)
            {
                healingButton.Draw(spriteBatch, Color.DarkGray);
            }
            else if (healingButton.CollisionRectangle.Contains(mouse.Position))
            {
                healingButton.Draw(spriteBatch, Color.LightSteelBlue);
            }
            else
            {
                healingButton.Draw(spriteBatch);
            }
            if ((level - 1) % 10 == 0 || saveGameOverrideEnabled)
            {
                if (saveButton.CollisionRectangle.Contains(mouse.Position))
                {
                    saveButton.Draw(spriteBatch, Color.LightSteelBlue);
                }
                else
                {
                    saveButton.Draw(spriteBatch);
                }
            }
            playerTradeMenuHealth.Draw(spriteBatch, (int)Health, GameConstants.PLAYER_MAX_HIT_POINTS, new Vector2(0, 0));
            #endregion
        }
Esempio n. 4
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            mouse = Mouse.GetState();

            background.Draw(spriteBatch, new Rectangle(0, 0, WindowWidth, WindowHeight));

            #region Item Boxes
            foreach (StaticEntity equipItemBoxBackground in equippedItemBoxBackgrounds)
            {
                equipItemBoxBackground.Draw(spriteBatch, Color.DimGray);
            }

            foreach (ItemBox itemBox in equippedItemBoxes)
            {
                if (itemBox.Sprite != null)
                {
                    if (itemBox.IsHovered)
                    {
                        itemBox.Draw(spriteBatch, Color.LightSteelBlue);
                    }
                    else
                    {
                        itemBox.Draw(spriteBatch);
                    }
                }
            }
            #endregion

            #region Tooltip text
            if (hoveredItemName != "")
            {
                spriteBatch.DrawString(font, hoveredItemName, new Vector2(TileSize, TileSize * 7), Color.Black);

                spriteBatch.DrawString(font, hoveredItemType, new Vector2(TileSize, TileSize * 7 + font.LineSpacing), Color.Black);

                if (hoveredItemDamage != "")
                {
                    spriteBatch.DrawString(font, "Damage: " + hoveredItemDamage, new Vector2(TileSize, TileSize * 7 + font.LineSpacing * 2), Color.Black);
                }

                spriteBatch.DrawString(font, "Effects: " + hoveredItemEffects, new Vector2(TileSize, TileSize * 7 + font.LineSpacing * 3), Color.Black);
                if (hoveredItemCooldown != "")
                {
                    spriteBatch.DrawString(font, "Cooldown: " + hoveredItemCooldown + " second(s)", new Vector2(TileSize, TileSize * 7 + font.LineSpacing * 4), Color.Black);
                }
                spriteBatch.DrawString(font, hoveredItemTooltip, new Vector2(TileSize, TileSize * 7 + font.LineSpacing * 5), Color.Black);
            }
            #endregion

            if (playButton.CollisionRectangle.Contains(mouse.Position))
            {
                playButton.Draw(spriteBatch, Color.LightSteelBlue);
            }
            else
            {
                playButton.Draw(spriteBatch);
            }

            #region General text

            spriteBatch.DrawString(font, "Left click on a weapon to equip it in the first slot.", new Vector2(TileSize / 2, 0), Color.Black);
            spriteBatch.DrawString(font, "Right click on a weapon to equip in in the second slot.", new Vector2(TileSize / 2, font.LineSpacing), Color.Black);
            spriteBatch.DrawString(font, "Click on a piece of equipment to put it in the third slot.", new Vector2(TileSize / 2, TileSize * 2 + font.LineSpacing), Color.Black);

            spriteBatch.DrawString(font, "Controls:", new Vector2(WindowWidth / 2 + TileSize * 2, TileSize * 7), Color.Black);
            spriteBatch.DrawString(font, "Left click to use the weapon in Slot One.", new Vector2(WindowWidth / 2 + TileSize * 2, TileSize * 7 + font.LineSpacing), Color.Black);
            spriteBatch.DrawString(font, "Right click to use the weapon in Slot Two.", new Vector2(WindowWidth / 2 + TileSize * 2, TileSize * 7 + font.LineSpacing * 2), Color.Black);
            spriteBatch.DrawString(font, "Spacebar to use equipment.", new Vector2(WindowWidth / 2 + TileSize * 2, TileSize * 7 + font.LineSpacing * 3), Color.Black);
            spriteBatch.DrawString(font, "Press Escape to pause and unpause the game.", new Vector2(WindowWidth / 2 + TileSize * 2, TileSize * 7 + font.LineSpacing * 4), Color.Black);
            #endregion

            #region Item boxes
            foreach (StaticEntity itemBoxBackground in itemBoxBackgrounds)
            {
                itemBoxBackground.Draw(spriteBatch, Color.DimGray);
            }

            foreach (ItemBox itemBox in itemBoxes)
            {
                if (itemBox.Sprite != null)
                {
                    if (itemBox.IsHovered)
                    {
                        itemBox.Draw(spriteBatch, Color.LightSteelBlue);
                    }
                    else
                    {
                        itemBox.Draw(spriteBatch);
                    }
                }
            }

            #endregion
        }
Esempio n. 5
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     spriteBatch.DrawString(font20, "Game Over!", new Vector2(GameConstants.WINDOW_WIDTH / 2 - gameOverButton.CollisionRectangle.Width / 2, 300), Color.White);
     gameOverButton.Draw(spriteBatch);
 }