Example #1
0
 /// <summary>Отрисовываем магию</summary>
 /// <param name="spriteBatch">The sprite batch.</param>
 /// <param name="rect">Область рисования</param>
 public void Draw(SpriteBatch spriteBatch, Rectangle rect)
 {
     if (_Executed)
     {
         _Sprite.Draw(spriteBatch, _CurrentRectangle);
     }
     else
     {
         if (_Reload > 0)
         {
             _Back.CurrentFrame = 1;
         }
         else
         {
             _Back.CurrentFrame = 0;
         }
         if (Selected)
         {
             _Back.CurrentFrame = 2;
         }
         _Back.Draw(spriteBatch, rect);
         _Sprite.Draw(spriteBatch, new Rectangle(rect.X + 5, rect.Y + 5, rect.Width - 5, rect.Height - 5));
         if (_ShowText)
         {
             spriteBatch.DrawString(_Font, Name, _TextVector, Color.Black);
         }
         if (_Reload > 0)
         {
             var     value  = _Reload / 100;
             Vector2 target = _Font.MeasureString(value.ToString()) / 2;
             spriteBatch.DrawString(_BigFont, value.ToString(), new Vector2(rect.Right - rect.Width / 2, rect.Bottom - rect.Height / 2), Color.White, 0, target, 1, SpriteEffects.None, 1);
         }
     }
 }
Example #2
0
        public override void Draw(SpriteBatch spriteBatch, Rectangle rectangle)
        {
            Rect = rectangle;
            _Sprite.Draw(spriteBatch, rectangle);
            Vector2 FontOrigin = _Font.MeasureString(Caption) / 2;

            spriteBatch.DrawString(_Font, Caption, new Vector2(rectangle.Right - rectangle.Width / 2, rectangle.Bottom - rectangle.Height / 2), Color.White, 0, FontOrigin, 1, SpriteEffects.None, 1);
        }
Example #3
0
        /// <summary>
        /// Рисовать в прямоугольнике
        /// </summary>
        /// <param name="spriteBatch">The sprite batch.</param>
        /// <param name="rectangle">Прямоугольник</param>
        public override void Draw(SpriteBatch spriteBatch, Rectangle rectangle)
        {
            Rect = rectangle;
            Vector2   FontOrigin = _Font.MeasureString(Caption) / 2;
            Rectangle rect       = new Rectangle(rectangle.Left + 5, rectangle.Top, 23, 50);

            _Minus.Draw(spriteBatch, rect);
            Rectangle LentRect = new Rectangle(rect.Right, rect.Top + 10, rectangle.Width - 80, 30);

            _Lent.Draw(spriteBatch, LentRect);
            spriteBatch.DrawString(_Font, Caption, new Vector2(LentRect.Right - LentRect.Width / 2, LentRect.Top + LentRect.Height / 2), Color.Black, 0, FontOrigin, 1, SpriteEffects.None, 1);
            rect = new Rectangle(LentRect.Right, rectangle.Top, 23, 50);
            _Plus.Draw(spriteBatch, rect);
        }
Example #4
0
 /// <summary>
 /// Рисовать в прямоугольнике
 /// </summary>
 /// <param name="spriteBatch">The sprite batch.</param>
 /// <param name="rectangle">Прямоугольник</param>
 public override void Draw(SpriteBatch spriteBatch, Rectangle rectangle)
 {
     _Sprite.Draw(spriteBatch, rectangle);
     spriteBatch.DrawString(_Font, Caption, new Vector2(rectangle.Left + 5, rectangle.Top), Color.Black);
     if (_Expand)
     {
         spriteBatch.Draw(_Panel, new Rectangle(rectangle.Left, rectangle.Bottom, rectangle.Width, 20 * _Values.Count), new Color(255, 255, 255, MathHelper.Clamp(70, 0, 255)));
         int i = 0;
         foreach (Control item in _Values)
         {
             item.Draw(spriteBatch, new Rectangle(rectangle.Left, rectangle.Bottom + 20 * i, rectangle.Width, 20));
             i++;
         }
     }
 }
Example #5
0
        /// <summary>Рисует персонажа</summary>
        public void Draw(SpriteBatch spriteBatch)
        {
            _CurrentState = _Movement.CurrentState;
            _CurrentCell  = _Movement.CurrentCell;
            _Tile.Draw(spriteBatch, _CurrentState);
            spriteBatch.DrawString(_Font, Name, new Vector2(_CurrentState.X + 10, _CurrentState.Y + 10), _Color);

            if (DrawEnemySelector)
            {
                spriteBatch.Draw(_EnemySelector, _CurrentState, Color.White);
            }
            if (DrawOurSelector)
            {
                spriteBatch.Draw(_OurSelector, _CurrentState, Color.White);
            }
        }
Example #6
0
        /// <summary>Рисуем</summary>
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Begin();
            Vector2 FontOrigin = _Font.MeasureString("SOURCERY") / 2;

            if (Cycle < 100)
            {
                spriteBatch.Draw(Background, Rect, Color.White);

                spriteBatch.DrawString(_Font, "SOURCERY", new Vector2(Rect.Width / 2, Rect.Height / 2), Color.Black, 0, FontOrigin, 1, SpriteEffects.None, 1);
                _Loader.Draw(spriteBatch, new Vector2(Rect.Width / 2 - 50, (Rect.Height / 2) + 50));
            }
            else
            {
                spriteBatch.Draw(Background, Rect, new Color(fadeOut, 0, 0));
            }

            spriteBatch.End();
        }
Example #7
0
        /// <summary>Рисуем</summary>
        /// <param name="spriteBatch">The sprite batch.</param>
        /// <param name="rect">Прямоугольник.</param>
        public void Draw(SpriteBatch spriteBatch, Rectangle rect)
        {
            _Sprite.Draw(spriteBatch, rect);
            int position;

            if (_MaxResourse != 0)
            {
                position = rect.Width * _CurrentResourse / _MaxResourse;
            }
            else
            {
                position = 0;
            }
            var     text       = _CurrentResourse.ToString() + "/" + _MaxResourse.ToString();
            Vector2 FontOrigin = _Font.MeasureString(text) / 2;

            spriteBatch.DrawString(_Font, text, new Vector2(rect.Right - rect.Width / 2, rect.Bottom - rect.Height / 2), Color.White, 0, FontOrigin, 1, SpriteEffects.None, 1);
            spriteBatch.Draw(_Back, new Rectangle(rect.X, rect.Y, position, rect.Height), new Color(0, 0, 0, 175));
        }
Example #8
0
        /// <summary>Рисуем компонент</summary>
        /// <param name="spriteBatch">The sprite batch.</param>
        /// <param name="rect">The rect.</param>
        public void Draw(SpriteBatch spriteBatch, Rectangle rect)
        {
            _Texture.Draw(spriteBatch, rect);
            Vector2 FontOrigin = _Font.MeasureString(_Text) / 2;

            spriteBatch.DrawString(_Font, _Text, new Vector2(rect.Right - rect.Width / 2, rect.Bottom - rect.Height / 2), Color.White, 0, FontOrigin, 1, SpriteEffects.None, 1);
            if (_Texture.CurrentFrame == 1 && _Draw)
            {
                Rectangle rc;
                if (_Text != "")
                {
                    rc             = new Rectangle((int)Math.Round(rect.Right - rect.Width / 2 + FontOrigin.X) - 5, (int)Math.Round(rect.Bottom - rect.Height / 2 - FontOrigin.Y) - 3, 15, 20);
                    _LastRectangle = rc;
                }
                else
                {
                    rc = _LastRectangle;
                }
                spriteBatch.Draw(_Cursor, rc, Color.White);
            }
        }
Example #9
0
 /// <summary>
 /// Рисовать в прямоугольнике
 /// </summary>
 /// <param name="spriteBatch">The sprite batch.</param>
 /// <param name="rectangle">Прямоугольник</param>
 public override void Draw(SpriteBatch spriteBatch, Rectangle rectangle)
 {
     Rect = rectangle;
     _Texture.Draw(spriteBatch, rectangle);
     spriteBatch.DrawString(_Font, Caption, new Vector2(rectangle.Left + 5, rectangle.Top), Color.Black);
 }
Example #10
0
 /// <summary>
 /// Рисовать в прямоугольнике
 /// </summary>
 /// <param name="spriteBatch">The sprite batch.</param>
 /// <param name="rectangle">Прямоугольник</param>
 public override void Draw(SpriteBatch spriteBatch, Rectangle rectangle)
 {
     Rect = rectangle;
     spriteBatch.DrawString(_Font, Caption, new Vector2(rectangle.Left + 40, rectangle.Top + 5), Color.Black);
     _Sprite.Draw(spriteBatch, new Rectangle(rectangle.Left, rectangle.Top, 30, 30));
 }