Ejemplo n.º 1
0
 private void ReAdd(IEnumerable <Recipe> receipes)
 {
     _craftList.Clear();
     foreach (var recipe in receipes)
     {
         var uiRecipe = new UICraftItem(recipe)
         {
             SizeFactor = new Vector2(1f, 0f),
         };
         _craftList.AddElement(uiRecipe);
     }
 }
Ejemplo n.º 2
0
        public void Add(UIElement element)
        {
            _inspectorList.Clear();
            foreach (var info in element.GetType().GetProperties())
            {
                if (info.IsDefined(typeof(Attributes.EditorPropertyIgnoreAttribute), true))
                {
                    continue;
                }
                int       height = 30;
                UIElement right  = GetRightElement(info, element, ref height);
                var       left   = new UILabel()
                {
                    Text        = info.Name,
                    Size        = new Vector2(-10, 20),
                    SizeStyle   = SizeStyle.Inline,
                    AnchorPoint = new Vector2(0, 0.5f),
                    Pivot       = new Vector2(0, 0.5f),
                    Position    = new Vector2(5, 0),
                };

                var item = new UITableBar(left, right)
                {
                    SizeFactor = new Vector2(1, 0),
                    Size       = new Vector2(0, height),
                };
                XmlNode info2 = null;
                if ((info2 = UIEditor.Instance.Documentation.GetPropertyInfo(info.DeclaringType.FullName + "." + info.Name)) != null)
                {
                    string desc = info2.InnerText.Trim();
                    item.LeftTooltip = desc;
                    left.Tooltip     = desc;
                }
                _inspectorList.AddElement(item);
            }
        }
Ejemplo n.º 3
0
        private void SetupButtons()
        {
            var pointer = new ToolBarButton()
            {
                Text          = $"指针",
                SizeFactor    = new Vector2(1, 0),
                Size          = new Vector2(0, 30),
                ButtonTexture = UIEditor.Instance.SkinManager.GetTexture("Icon_Mouse"),
            };

            pointer.OnClick += Pointer_OnClick;
            _toolBarList.AddElement(pointer);
            var empty = new ToolBarButton()
            {
                Text          = $"空节点",
                SizeFactor    = new Vector2(1, 0),
                Size          = new Vector2(0, 30),
                ButtonTexture = UIEditor.Instance.SkinManager.GetTexture("NoTexture"),
            };

            empty.OnClick += Empty_OnClick;
            _toolBarList.AddElement(empty);
            var button = new ToolBarButton()
            {
                Text          = $"按钮",
                SizeFactor    = new Vector2(1, 0),
                Size          = new Vector2(0, 30),
                ButtonTexture = UIEditor.Instance.SkinManager.GetTexture("Icon_Button"),
            };

            button.OnClick += Button_OnClick;
            _toolBarList.AddElement(button);
            var label = new ToolBarButton()
            {
                Text          = $"标签文本",
                SizeFactor    = new Vector2(1, 0),
                Size          = new Vector2(0, 30),
                ButtonTexture = UIEditor.Instance.SkinManager.GetTexture("Icon_Label"),
            };

            label.OnClick += Label_OnClick;
            _toolBarList.AddElement(label);
            var textBox = new ToolBarButton()
            {
                Text          = $"文本框",
                SizeFactor    = new Vector2(1, 0),
                Size          = new Vector2(0, 30),
                ButtonTexture = UIEditor.Instance.SkinManager.GetTexture("Icon_Textbox"),
            };

            textBox.OnClick += TextBox_OnClick;
            _toolBarList.AddElement(textBox);
            var progressBar = new ToolBarButton()
            {
                Text          = $"进度条",
                SizeFactor    = new Vector2(1, 0),
                Size          = new Vector2(0, 30),
                ButtonTexture = UIEditor.Instance.SkinManager.GetTexture("Icon_ProgressBar"),
            };

            progressBar.OnClick += ProgressBar_OnClick;
            _toolBarList.AddElement(progressBar);
            var panelBar = new ToolBarButton()
            {
                Text          = $"面板",
                SizeFactor    = new Vector2(1, 0),
                Size          = new Vector2(0, 30),
                ButtonTexture = UIEditor.Instance.SkinManager.GetTexture("Icon_Panel"),
            };

            panelBar.OnClick += PanelBar_OnClick;
            _toolBarList.AddElement(panelBar);
            var picture = new ToolBarButton()
            {
                Text          = $"图片",
                SizeFactor    = new Vector2(1, 0),
                Size          = new Vector2(0, 30),
                ButtonTexture = UIEditor.Instance.SkinManager.GetTexture("Icon_Picture"),
            };

            picture.OnClick += Picture_OnClick;
            _toolBarList.AddElement(picture);
        }