Esempio n. 1
0
        public Inspecter(EditorState editor) : base(editor)
        {
            _inspecterPanel = new UIPanel()
            {
                Pivot       = new Vector2(0, 0),
                AnchorPoint = new Vector2(0, 0),
                Position    = new Vector2(5, 5),
                SizeFactor  = new Vector2(1, 1),
                Size        = new Vector2(-10, -9),
            };
            _inspectorList = new UIList()
            {
                AnchorPoint = new Vector2(0, 0),
                Pivot       = new Vector2(0, 0),
                SizeFactor  = new Vector2(1f, 1f),
                Size        = new Vector2(-10f, -10f),
                Position    = new Vector2(5f, 5f),
            };
            var scrollBar1 = new UIScrollBarV()
            {
                Name        = "ScrollBar",
                AnchorPoint = new Vector2(1, 0.5f),
                Pivot       = new Vector2(1, 0.5f),
            };

            _inspectorList.SetScrollBarV(scrollBar1);
            _inspecterPanel.AppendChild(_inspectorList);
            AppendChild(_inspecterPanel);
        }
Esempio n. 2
0
        public Viewer(EditorState editor) : base(editor)
        {
            PropagationRule = PropagationFlags.FocusEvents | PropagationFlags.ScrollWheel;

            _viewerPanel = new UIPanel()
            {
                Pivot       = new Vector2(0, 0),
                AnchorPoint = new Vector2(0, 0),
                Position    = new Vector2(5, 5),
                SizeFactor  = new Vector2(1, 1),
                Size        = new Vector2(-10, -10),
            };
            AppendChild(_viewerPanel);
            Canvas = new Canvas(editor)
            {
                Name        = "画布",
                Pivot       = new Vector2(0.5f, 0.5f),
                AnchorPoint = new Vector2(0.5f, 0.5f),
                Size        = new Vector2(1920, 1080),
            };
            Middle = new ViewerMiddle(Canvas)
            {
                Pivot       = new Vector2(0, 0),
                AnchorPoint = new Vector2(0, 0),
                Position    = new Vector2(2, 2),
                SizeFactor  = new Vector2(1, 1),
                Size        = new Vector2(-4, -4),
                Overflow    = OverflowType.Hidden,
            };
            _viewerPanel.AppendChild(Middle);
        }
Esempio n. 3
0
        public UIClassifiers(RecipeGraphState main) : base(main)
        {
            _filters = new ItemFilters();
            var panel = new UIPanel()
            {
                AnchorPoint = new Vector2(0.5f, 0.5f),
                SizeFactor  = new Vector2(1, 1),
            };

            _list = new UITreeList()
            {
                AnchorPoint = new Vector2(0.5f, 0.5f),
                SizeFactor  = new Vector2(1, 1),
                Size        = new Vector2(-10, -10),
            };
            var scroll = new UIScrollBarV()
            {
                AnchorPoint = new Vector2(1, 0.5f),
                Pivot       = new Vector2(1, 0.5f),
            };

            _list.SetScrollBarV(scroll);
            panel.AppendChild(_list);
            foreach (var pair in _filters.ModFilters)
            {
                List <UITreeNode> itemcls = new List <UITreeNode>();
                foreach (var pair2 in _filters.Filters)
                {
                    var citem = new UIClassifierItem(pair2.Value.Name, pair2.Value.Texture)
                    {
                        Name       = pair.Key + " " + pair2.Key,
                        SizeFactor = new Vector2(1f, 0f),
                        Size       = new Vector2(0, 36f),
                    };
                    citem.OnClick += Button_OnClick;
                    itemcls.Add(new UITreeNode(citem, new List <UITreeNode>()));
                }
                var moditem = new UIClassifierItem(pair.Value.Name, pair.Value.Texture)
                {
                    Name       = pair.Key,
                    SizeFactor = new Vector2(1f, 0f),
                    Size       = new Vector2(0, 36f),
                };
                var node = new UITreeNode(moditem, itemcls);
                moditem.OnClick += Button_OnClick;
                _list.AddElement(node);
                if (pair.Key == "All")
                {
                    _list.SelectedElement = node.DisplayElement;
                }
            }
            AppendChild(panel);
        }
Esempio n. 4
0
        public UIRecipeGraph(RecipeGraphState main) : base(main)
        {
            _canvasPanel = new UIPanel()
            {
                Pivot           = new Vector2(0.5f, 0),
                AnchorPoint     = new Vector2(0.5f, 0),
                Position        = new Vector2(0, 5f),
                SizeFactor      = new Vector2(1, 0.6f),
                Size            = new Vector2(-10, -10),
                PropagationRule = UIEditor.UILib.Enums.PropagationFlags.FocusEvents,
            };
            Canvas = new UICanvas(MainState)
            {
                AnchorPoint = new Vector2(0.5f, 0.5f),
                SizeFactor  = new Vector2(1, 1),
                Size        = new Vector2(-4, -4),
            };

            AppendChild(_canvasPanel);
            _canvasPanel.AppendChild(Canvas);

            var panel = new UIPanel()
            {
                Pivot       = new Vector2(0.5f, 1),
                AnchorPoint = new Vector2(0.5f, 1f),
                Position    = new Vector2(0, -5),
                SizeFactor  = new Vector2(1, 0.4f),
                Size        = new Vector2(-10, -10),
            };

            AppendChild(panel);
            _craftList = new UIList()
            {
                AnchorPoint = new Vector2(0.5f, 0.5f),
                SizeFactor  = new Vector2(1f, 1f),
                Size        = new Vector2(-10, -10),
            };
            var scrollV = new UIScrollBarV()
            {
                AnchorPoint = new Vector2(1, 0.5f),
                Pivot       = new Vector2(1, 0.5f),
            };

            _craftList.SetScrollBarV(scrollV);
            panel.AppendChild(_craftList);
        }
Esempio n. 5
0
        public Browser(EditorState editor) : base(editor)
        {
            PropagationRule = PropagationFlags.FocusEvents;
            _listPanel      = new UIPanel()
            {
                AnchorPoint  = new Vector2(0, 0),
                Pivot        = new Vector2(0, 0),
                SizeFactor   = new Vector2(1f, 1f),
                Size         = new Vector2(-15f, -10f),
                Position     = new Vector2(15f, 5f),
                PanelTexture = UIEditor.Instance.SkinManager.GetTexture("Box_Default"),
            };
            _treeList = new UIBrowserTreeList(Editor)
            {
                AnchorPoint = new Vector2(0, 0),
                Pivot       = new Vector2(0, 0),
                SizeFactor  = new Vector2(1f, 1f),
                Size        = new Vector2(-10f, -10f),
                Position    = new Vector2(5f, 5f),
            };
            var scrollBar1 = new UIScrollBarV()
            {
                Name        = "ScrollBar",
                AnchorPoint = new Vector2(1, 0.5f),
                Pivot       = new Vector2(1, 0.5f),
            };
            var scrollBar2 = new UIScrollBarH()
            {
                Name = "ScrollBarH",
            };
            var toolbar2 = new UIToolBarV()
            {
                SizeFactor      = new Vector2(1f, 1f),
                AnchorPoint     = new Vector2(0f, 0.5f),
                Pivot           = new Vector2(0f, 0.5f),
                PropagationRule = PropagationFlags.BLOCK_ALL,
                ButtonTooltip   = "工具栏",
            };

            AppendChild(_listPanel);
            AppendChild(toolbar2);
            _listPanel.AppendChild(_treeList);
            _treeList.SetScrollBarV(scrollBar1);
            _treeList.SetScrollBarH(scrollBar2);
            _treeList.OnSelect += _treeList_OnSelect;

            _toolBarList = new UISelectableList()
            {
                Pivot      = new Vector2(0, 0),
                Position   = new Vector2(10, 10),
                SizeFactor = new Vector2(1, 1),
                Size       = new Vector2(-20, -20),
            };

            SetupButtons();
            var scrollBar3 = new UIScrollBarV()
            {
                Name        = "工具栏滚动条",
                AnchorPoint = new Vector2(1, 0.5f),
                Pivot       = new Vector2(1, 0.5f),
            };

            _toolBarList.SetScrollBarV(scrollBar3);
            toolbar2.AddToPanel(_toolBarList);
        }
Esempio n. 6
0
 public void AddToPanel(UIElement element)
 {
     _toolPanel.AppendChild(element);
 }
Esempio n. 7
0
        public UIEnumSelector(UIElement target, PropertyInfo property) : base()
        {
            PropertyInfo = property;
            Target       = target;
            _label       = new UILabel()
            {
                Pivot       = new Vector2(0f, 0.5f),
                AnchorPoint = new Vector2(0f, 0.5f),
                NoEvent     = true,
                SizeStyle   = SizeStyle.Block,
                Text        = property.GetValue(target).ToString(),
                Position    = new Vector2(2f, 0f),
            };
            _expandButton = new UIImageButton()
            {
                Texture      = UIEditor.Instance.SkinManager.GetTexture("Down"),
                WhiteTexture = UIEditor.Instance.SkinManager.GetTexture("Down_Border"),
                Pivot        = new Vector2(1, 0.5f),
                AnchorPoint  = new Vector2(1, 0.5f),
                SizeStyle    = SizeStyle.Inline,
                Position     = new Vector2(-1, 0),
            };
            _expandButton.OnClick += _expandButton_OnClick;

            var values = property.PropertyType.GetEnumValues();

            _list = new UISelectableList {
                Name = "Values",
                InnerContainerPadding = 2,
                AnchorPoint           = new Vector2(0f, 0),
                Pivot      = new Vector2(0f, 0),
                SizeFactor = new Vector2(1f, 1f),
                Position   = new Vector2(2, 2),
                Size       = new Vector2(-4, -4),
            };
            var scrollBar = new UIScrollBarV()
            {
                Name        = "Enum_ScrollBar",
                AnchorPoint = new Vector2(1, 0.5f),
                Pivot       = new Vector2(1, 0.5f),
            };

            _list.SetScrollBarV(scrollBar);
            foreach (var value in values)
            {
                _list.AddElement(new EnumValueButton((Enum)value));
            }
            _list.OnSelect += List_OnSelect;
            _list.IsActive  = true;

            _listPanel = new UIPanel()
            {
                Size        = new Vector2(Width, 200),
                Pivot       = new Vector2(0, 0),
                AnchorPoint = new Vector2(0, 0),
                IsActive    = false,
            };
            _listPanel.AppendChild(_list);
            AppendChild(_label);
            // AppendChild(_list);
            AppendChild(_expandButton);
        }