public override void OnLayerBuild()
        {
            Size = new Vector2(13, 100);

            _upBtn       = CurEuiCore.CreateElement <Button>();
            _upBtn.Style = VertticalButtonUpStyle;
            _upBtn.SetAnchor(AnchorType.MiddleTop);
            _upBtn.Size  = new Vector2(13, 16);
            _upBtn.Pivot = new Vector2(0.5f, 0);
            _upBtn.SetParent(this);
            _upBtn.OnClickEvt += () => { ScrollValue(-0.1f); };

            _downBtn       = CurEuiCore.CreateElement <Button>();
            _downBtn.Style = VerticalButtonDownStyle;
            _downBtn.SetAnchor(AnchorType.MiddleBottom);
            _downBtn.Pivot = new Vector2(0.5f, 1);
            _downBtn.Size  = new Vector2(13, 16);
            _downBtn.SetParent(this);
            _downBtn.OnClickEvt += () => { ScrollValue(0.1f); };


            _sliderInline           = CurEuiCore.CreateElement <SliderInline>();
            _sliderInline.Scrollbar = this;
            _sliderInline.Size      = new Vector2(13, 50);
            _sliderInline.Pivot     = new Vector2(0.5f, 0);
            _sliderInline.SetAnchor(AnchorType.MiddleTop);
            _sliderInline.SetParent(this);
            _sliderInline.OnPositionChange += (x) =>
            {
                Value = (x.y - 16) / (RectInfo.height - _sliderInline.RectInfo.height - 32);
            };

            SetValue(0);
        }
 public override void OnLayerBuild()
 {
     base.OnLayerBuild();
     _verticalScrollbar = CurEuiCore.CreateElement <VerticalScrollbar>();
     _verticalScrollbar.SetAnchor(AnchorType.RightStretch);
     _verticalScrollbar.Pivot = new Vector2(1, 0.5f);
     _verticalScrollbar.SetParent(this);
     _verticalScrollbar.OnValueChanged += (x) => { RefreshContentPosition(); };
     _verticalScrollbar.SetSliderHeightRelative(0.4f);
     SetActiveClip(true);
 }
예제 #3
0
        public override void OnLayerBuild()
        {
            base.OnLayerBuild();
            StackLayout sl = CurEuiCore.CreateElement <StackLayout>();

            sl.SetParent(this);
            sl.SetAnchor(AnchorType.Stretch);

            Type[] types = typeof(ToolsLeftArea).Assembly.GetTypes();
            foreach (var type in types)
            {
                BindUI bingUI = type.GetCustomAttribute <BindUI>();
                if (bingUI != null && type.IsSubclassOf(typeof(BaseEditorUI)) && !_bindUis.ContainsKey(bingUI.Ui))
                {
                    _types.Add(type);
                    Button btn = CurEuiCore.CreateElement <Button>();
                    btn.SetParent(sl);
                    btn.Height = 30;
                    btn.Text   = bingUI.Ui.Name;
                }
            }
        }