Ejemplo n.º 1
0
 public TexturePrev(MultiSprite image, Tiles tileType, ContentManager content)
     : base(image)
 {
     this.tileType = tileType;
     text          = TextSprite.CreateSprite(content, Fnames.TEXT_FONT, new Vector2(image.Bounds.Left, image.Bounds.Bottom), tileType.ToString());
     text.Position = new Vector2(image.Bounds.Left + (image.Bounds.Width - text.Size.X) / 2, image.Bounds.Bottom);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Создает новый ползунок с указанными параметрами
        /// </summary>
        /// <param name="image">Изображение тела ползунка</param>
        /// <param name="image_">Изображение каретки ползунка</param>
        public Slider(MultiSprite image, Sprite image_, ContentManager content, string text = "") : base(image)
        {
            this.image_        = image_;
            this.image_.Color  = Color.Black;
            this.text          = TextSprite.CreateSprite(content, Fnames.TEXT_FONT, new Vector2(Image.Bounds.Left, Image.Bounds.Top), text);
            this.text.Position = new Vector2(Image.Bounds.Left + (Image.Bounds.Width - this.text.Size.X) / 2, Image.Bounds.Top - this.text.Size.Y);
            this.MouseMove    += new EventHandler <MouseElementEventArgs>(Slider_MouseMove);

            Value = 100;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Создает новый элемента PrevList с указанными параметрами.
        /// Правая часть скопируется с левой и отразится по горизонтали
        /// </summary>
        /// <param name="image">Изображение левой части элемента</param>
        /// <param name="content">Управляющий контентом</param>
        /// <param name="prevsInOneDim">Максимальное кол-во элементов TexturePrev в одном измерении</param>
        /// <param name="formatMethod">Метод, применяемый к каждому элементу TexturePrev при горизонтальном форматировании (вертикальное форматирование встроено)</param>
        public PrevList(MultiSprite image, ContentManager content, ushort prevsInOneDim, Action <TexturePrev> formatMethod)
            : base(image)
        {
            currentListNumberText          = TextSprite.CreateSprite(content, Fnames.TEXT_FONT, new Vector2(image.Bounds.Right + 1, image.Bounds.Top), "");
            currentListNumberText.Position = new Vector2(image.Bounds.Right + 1, image.Bounds.Top);
            image2 = (MultiSprite)image.Clone();
            image2.SpriteEffect = SpriteEffects.FlipHorizontally;
            image2.MoveOn(new Vector2(image.Size.X + currentListNumberText.Font.MeasureString("0").X + 2, 0));
            list.Add(new List <TexturePrev>());
            CurrentListNumber = 0;
            PrevsInOneDim     = prevsInOneDim;
            FormatMethod      = formatMethod;

            this.Click      += new EventHandler <MouseElementEventArgs>(PrevList_Click);
            this.ClickRight += new EventHandler <MouseElementEventArgs>(PrevList_ClickRight);
        }