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 }; }
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; }; }
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); }
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; }
public UIInteractable(float x, float y, float width, float height, UIContainer parent = null, UISizeMethod sizing = UISizeMethod.UV) : base(x, y, width, height, parent, sizing) { }
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; }