public UIValueSlider() : base() { Overflow = OverflowType.Hidden; Name = "滑动值域"; PropagationRule = Enums.PropagationFlags.FocusEvents | Enums.PropagationFlags.ScrollWheel; Min = 0; Max = 1; _slider = new UIInnerSlider() { Pivot = new Vector2(0, 0), AnchorPoint = new Vector2(0, 0), SizeFactor = new Vector2(0.7f, 1f), }; _display = new UIValueTextBox <int>(0) { Pivot = new Vector2(0, 0), AnchorPoint = new Vector2(0, 0), SizeFactor = new Vector2(0.3f, 1f), Size = new Vector2(-7, 0), }; _display.Text = Min.ToString(); _display.OnValueChanged += _display_OnValueChanged; _slider.OnValueChanged += _slider_OnValueChanged; SliderColor = UIEditor.Instance.SkinManager.GetColor("Background2"); AppendChild(_slider); AppendChild(_display); }
public UIVector2(UIElement target, PropertyInfo property) : base() { PropertyInfo = property; Target = target; Vector2 vec = (Vector2)PropertyInfo.GetValue(target); _xl = new UILabel() { Text = "X", Pivot = new Vector2(0, 0.5f), AnchorPoint = new Vector2(0, 0.5f), SizeStyle = SizeStyle.Block, SizeFactor = new Vector2(0.1f, 0f), }; _yl = new UILabel() { Text = "Y", Pivot = new Vector2(0, 0.5f), AnchorPoint = new Vector2(0, 0.5f), SizeStyle = SizeStyle.Block, SizeFactor = new Vector2(0.1f, 0f), }; _textX = new UIValueTextBox <float>(vec.X) { Pivot = new Vector2(0, 0.5f), AnchorPoint = new Vector2(0, 0.5f), SizeFactor = new Vector2(0.4f, 1f), Size = new Vector2(-5, 0f), }; _textY = new UIValueTextBox <float>(vec.Y) { Pivot = new Vector2(0, 0.5f), AnchorPoint = new Vector2(0, 0.5f), SizeFactor = new Vector2(0.4f, 1f), Size = new Vector2(-5, 0f), }; _textX.OnValueChanged += _textX_OnValueChanged; _textY.OnValueChanged += _textX_OnValueChanged; AppendChild(_xl); AppendChild(_yl); AppendChild(_textX); AppendChild(_textY); }
public UIRectangle(UIElement target, PropertyInfo property) : base() { PropertyInfo = property; Target = target; Rectangle rect = (Rectangle)PropertyInfo.GetValue(target); _xl = new UILabel() { Text = "X", Pivot = new Vector2(0, 0f), AnchorPoint = new Vector2(0, 0f), SizeStyle = SizeStyle.Block, SizeFactor = new Vector2(0.1f, 0f), }; _yl = new UILabel() { Text = "Y", Pivot = new Vector2(0, 0f), AnchorPoint = new Vector2(0, 0f), SizeStyle = SizeStyle.Block, SizeFactor = new Vector2(0.1f, 0f), }; _wl = new UILabel() { Text = "W", Pivot = new Vector2(0, 1f), AnchorPoint = new Vector2(0, 1f), SizeStyle = SizeStyle.Block, SizeFactor = new Vector2(0.1f, 0f), }; _hl = new UILabel() { Text = "H", Pivot = new Vector2(0, 1f), AnchorPoint = new Vector2(0, 1f), SizeStyle = SizeStyle.Block, SizeFactor = new Vector2(0.1f, 0f), }; _textX = new UIValueTextBox <float>(rect.X) { Pivot = new Vector2(0, 0f), AnchorPoint = new Vector2(0, 0f), SizeFactor = new Vector2(0.4f, 0f), Size = new Vector2(-5, 30f), }; _textY = new UIValueTextBox <float>(rect.Y) { Pivot = new Vector2(0, 0f), AnchorPoint = new Vector2(0, 0f), SizeFactor = new Vector2(0.4f, 0f), Size = new Vector2(-5, 30f), }; _textW = new UIValueTextBox <float>(rect.Width) { Pivot = new Vector2(0, 1f), AnchorPoint = new Vector2(0, 1f), SizeFactor = new Vector2(0.4f, 0f), Size = new Vector2(-5, 30f), }; _textH = new UIValueTextBox <float>(rect.Height) { Pivot = new Vector2(0, 1f), AnchorPoint = new Vector2(0, 1f), SizeFactor = new Vector2(0.4f, 0f), Size = new Vector2(-5, 30f), }; _textX.OnValueChanged += _textX_OnValueChanged; _textY.OnValueChanged += _textX_OnValueChanged; AppendChild(_xl); AppendChild(_yl); AppendChild(_wl); AppendChild(_hl); AppendChild(_textX); AppendChild(_textY); AppendChild(_textW); AppendChild(_textH); }