Exemple #1
0
 public UIButton(float x, float y, float width, float height, string text, UIContainer parent, UISizeMethod sizing = UISizeMethod.UV) : base(x, y, width, height, parent, sizing)
 {
     label = new UILabel(0, 0, 1, 1, text, this, UISizeMethod.UV, UIAlignment.Center)
     {
         color = Color.Black
     };
 }
Exemple #2
0
        public UIDropDown(float x, float y, float width, float height, UIContainer parent, UISizeMethod sizing = UISizeMethod.UV) : base(x, y, width, height, "---", parent, sizing)
        {
            new UIImage(0, 0, 1, 1, Textures.UI.DropDownArrow, label, UISizeMethod.UV);

            Click += (object sender, EventArgs e) =>
            {
                isOpen = !isOpen;
            };
        }
Exemple #3
0
        public override void Draw(SpriteBatch spriteBatch, int currentHover)
        {
            if (!HasFocus())
            {
                isOpen = false;
            }

            for (int i = 1; i < children.Count; i++)
            {
                UIContainer element = children[i];
                if (isOpen)
                {
                    element.Show();
                }
                else
                {
                    element.Hide();
                }
            }

            base.Draw(spriteBatch, currentHover);
        }
Exemple #4
0
 public UILabel(float x, float y, float width, float height, string text, UIContainer parent = null, UISizeMethod sizing = UISizeMethod.UV, UIAlignment alignment = UIAlignment.Center) : base(x, y, width, height, parent, sizing)
 {
     Text           = text;
     this.alignment = alignment;
 }
Exemple #5
0
 public UIInteractable(float x, float y, float width, float height, UIContainer parent = null, UISizeMethod sizing = UISizeMethod.UV) : base(x, y, width, height, parent, sizing)
 {
 }
Exemple #6
0
 public UIImage(float x, float y, float width, float height, Texture2D texture, UIContainer parent = null, UISizeMethod sizing = UISizeMethod.UV) : base(x, y, width, height, parent, sizing)
 {
     this.texture = texture;
 }