Example #1
0
 public override void Draw(SpriteBatch spriteBatch)
 {
     if (!castingSpell)
     {
         if (nameWindow != null)
         {
             nameWindow.Draw(spriteBatch);
         }
         base.Draw(spriteBatch);
         for (int i = 0; i < spells.Length; i++)
         {
             spells[i].Draw(spriteBatch);
             spriteBatch.DrawString(smallFont, pc.Spells[i].DisplayName, new Vector2(spells[i].Bounds.X, spells[i].Bounds.Y - 16), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.14f);
             spriteBatch.DrawString(smallFont, TextMethods.WrapText(smallFont, pc.Spells[i].Description, 182), new Vector2(spells[i].Bounds.X + 68, spells[i].Bounds.Y + 16), Color.Black, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.14f);
             spriteBatch.DrawString(smallFont, "SP Cost: " + pc.Spells[i].ManaCost(pc).ToString(), new Vector2(spells[i].Bounds.X + 192, spells[i].Bounds.Y + 64), Color.Blue, 0.0f, Vector2.Zero, 1.0f, SpriteEffects.None, 0.14f);
         }
     }
     else
     {
         var drawVector = new Vector2(game.GetScreenWidth() / 2, 96);
         spriteBatch.Draw(castSpellTextBack, new Rectangle((int)drawVector.X, (int)drawVector.Y, 400, 64), null, Color.White, 0, new Vector2(200, 32), SpriteEffects.None, 0.01f);
         spriteBatch.DrawString(game.mediumFont, castWorldSpellText, drawVector, Color.White, 0, TextMethods.CenterText(game.mediumFont, castWorldSpellText), 1, SpriteEffects.None, 0.00f);
     }
 }
Example #2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);
            var drawVector = new Vector2(TopLeft.X + 23, TopLeft.Y + 64);

            for (int i = 0; i < pc.Equips.Length; i++)
            {
                if (pc.Equips[i] != null)
                {
                    spriteBatch.Draw(pc.Equips[i].Icon, new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.17f);
                }
                drawVector.X += 67;
            }
            drawVector = new Vector2(TopLeft.X + 23, TopLeft.Y + 153);
            var firstEquips = new List <Item>();

            for (int i = 0; i < pc.Inventory.Count; i++)
            {
                var drawRectangle = new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64);
                spriteBatch.Draw(pc.Inventory[i].Icon, new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.17f);
                if ((pc.Inventory[i] is EquippableItem))
                {
                    if (pc.Equips.Contains((EquippableItem)pc.Inventory[i]) && !firstEquips.Contains(pc.Inventory[i]))
                    {
                        spriteBatch.Draw(equipIcon, new Rectangle((int)drawVector.X + 4, (int)drawVector.Y + 4, 16, 16), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.14f);
                        firstEquips.Add(pc.Inventory[i]);
                    }
                }
                if (game.Input.IsMouseOver(drawRectangle))
                {
                    if (drawHighlight)
                    {
                        spriteBatch.Draw(highlight, new Rectangle((int)drawVector.X, (int)drawVector.Y, 64, 64), Color.White);
                    }
                    if (draggedItemIndex == -1 && droppedItemIndex == -1 && displayNameWindow == false)
                    {
                        spriteBatch.DrawString(game.mediumFont, TextMethods.WrapText(game.mediumFont, pc.Inventory[i].DisplayName, 400), new Vector2(TopLeft.X + 458, TopLeft.Y + 23), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, TextMethods.WrapText(game.mediumFont, pc.Inventory[i].DisplayName, 400)), 1.0f, SpriteEffects.None, 0.17f);
                        spriteBatch.Draw(pc.Inventory[i].Icon, new Rectangle(TopLeft.X + 458, TopLeft.Y + 100, 64, 64), null, Color.White, 0.0f, new Vector2(pc.Inventory[i].Icon.Width / 2, pc.Inventory[i].Icon.Height / 2), SpriteEffects.None, 0.17f);
                        spriteBatch.DrawString(game.smallFont, pc.Inventory[i].Description, new Vector2(TopLeft.X + 458, TopLeft.Y + 164), Color.Black, 0.0f, TextMethods.CenterText(game.smallFont, pc.Inventory[i].Description), 1.0f, SpriteEffects.None, 0.17f);
                        if (pc.Inventory[i] is EquippableItem)
                        {
                            var equip = (EquippableItem)pc.Inventory[i];
                            for (int e = 0; e < equip.equipEffects.Count; e++)
                            {
                                spriteBatch.DrawString(game.smallFont, equip.equipEffects[e].Description(), new Vector2(TopLeft.X + 458, TopLeft.Y + 252 + (12 * e)), Color.Black, 0.0f, TextMethods.CenterText(game.smallFont, equip.equipEffects[e].Description()), 1.0f, SpriteEffects.None, 0.17f);
                            }
                        }
                        if (pc.Inventory[i] is ConsumableItem)
                        {
                            var consum = (ConsumableItem)pc.Inventory[i];
                            if (consum.BattleAction != null)
                            {
                                for (int e = 0; e < consum.BattleAction.actionEffects.Count; e++)
                                {
                                    spriteBatch.DrawString(game.smallFont, consum.BattleAction.ReturnInventoryDescription(e), new Vector2(TopLeft.X + 458, TopLeft.Y + 252 + (12 * e)), Color.Black, 0.0f, TextMethods.CenterText(game.smallFont, consum.BattleAction.ReturnInventoryDescription(e)), 1.0f, SpriteEffects.None, 0.17f);
                                }
                            }
                        }
                    }
                }
                drawVector.X += 67;
                if (i == 3)
                {
                    drawVector.X = TopLeft.X + 23;
                    drawVector.Y = TopLeft.Y + 220;
                }
                if (i == 7)
                {
                    drawVector.X = TopLeft.X + 23;
                    drawVector.Y = TopLeft.Y + 287;
                }
                if (i == 11)
                {
                    drawVector.X = TopLeft.X + 23;
                    drawVector.Y = TopLeft.Y + 354;
                }
            }
            if (dragAndDropActive && !confirmDropItem)
            {
                spriteBatch.Draw(pc.Inventory[draggedItemIndex].Icon, new Rectangle(game.Input.oldMouseState.X, game.Input.oldMouseState.Y, 64, 64), null, Color.FromNonPremultiplied(225, 225, 225, 135), 0.0f, new Vector2(32, 32), SpriteEffects.None, 0.0f);
            }
            if (confirmDropItem)
            {
                spriteBatch.Draw(confirmWindow, new Rectangle(game.GetScreenWidth() / 2, game.GetScreenHeight() / 2, 384, 192), null, Color.White, 0.0f, new Vector2(192, 69), SpriteEffects.None, 0.02f);
                spriteBatch.DrawString(game.mediumFont, strings[0], new Vector2(game.GetScreenWidth() / 2, game.GetScreenHeight() / 2), Color.Black, 0.0f, TextMethods.CenterText(game.mediumFont, strings[0]), 1.0f, SpriteEffects.None, 0.01f);
                ConfirmButtons[0].Draw(spriteBatch);
                ConfirmButtons[1].Draw(spriteBatch);
            }
            if (displayNameWindow)
            {
                NameWindow.Draw(spriteBatch);
            }
            if (inBattle)
            {
                spriteBatch.Draw(greyedOut, new Rectangle(TopLeft.X + 348, TopLeft.Y + 413, 86, 50), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f);
                spriteBatch.Draw(greyedOut, new Rectangle(TopLeft.X + 440, TopLeft.Y + 413, 86, 50), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f);
            }
            if (inBattle)
            {
                if (party.ActiveCharacters.Count == 1)
                {
                    spriteBatch.Draw(greyedOut, new Rectangle(TopLeft.X + 348, TopLeft.Y + 413, 86, 50), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.01f);
                }
            }
        }