Exemplo n.º 1
0
 public UIScrollBarV() : base()
 {
     Name            = "垂直滚动条";
     PropagationRule = Enums.PropagationFlags.FocusEvents;
     _currentValue   = 0;
     _isMouseOver    = false;
     _outerBar       = new UIBar()
     {
         Texture     = Main.magicPixel,
         SizeFactor  = new Vector2(1f, 1f),
         AnchorPoint = new Vector2(0.5f, 0.5f),
         EndSize     = 6
     };
     _innerBar = new UIBar()
     {
         Name        = "Inner",
         Texture     = Main.magicPixel,
         SizeFactor  = new Vector2(1f, 0.5f),
         Pivot       = new Vector2(0.5f, 0),
         AnchorPoint = new Vector2(0.5f, 0),
         EndSize     = 6
     };
     BackgroundColor         = Color.Gray * 0.6f;
     DefaultInnerColor       = Color.White * 0.5f;
     MouseMoveInnerColor     = Color.White;
     _innerBar.OnMouseEnter += _innerBar_OnMouseOver;
     _innerBar.OnMouseOut   += _innerBar_OnMouseOut;
     _innerBar.OnMouseDown  += _innerBar_OnMouseDown;
     _innerBar.OnMouseUp    += _innerBar_OnMouseUp;
     _timer = 0;
     AppendChild(_outerBar);
     _outerBar.AppendChild(_innerBar);
 }
Exemplo n.º 2
0
 public UIInnerSlider() : base()
 {
     _innerLine = new UIBar()
     {
         AnchorPoint = new Vector2(0.5f, 0.5f),
         SizeFactor  = new Vector2(1f, 0f),
         Size        = new Vector2(-10, 3),
         Position    = new Vector2(0f, 0),
         Texture     = Main.magicPixel,
     };
     _currentValue = 0f;
     _sliderButton = new UIButton()
     {
         AnchorPoint  = new Vector2(0f, 0.5f),
         Pivot        = new Vector2(0.5f, 0.5f),
         Size         = new Vector2(12, 30),
         PanelTexture = UIEditor.Instance.SkinManager.GetTexture("BoxTR_Default"),
         CornerSize   = new Vector2(6f, 6f),
         DrawPanel    = true,
         Text         = "",
         Position     = new Vector2(5f, 0),
     };
     AppendChild(_innerLine);
     AppendChild(_sliderButton);
 }