Exemplo n.º 1
0
        public void AddItem(string name, EditorPopupMenu pop)
        {
            EditorButton btn = NodeFactoryXML.CreateEditorControl <EditorButton>();

            btn.Content      = name;
            btn.DefaultStyle = true;
            btn.Style        = EditorStyles.toolbarDropDown;
            btn.OnBtnClick   = OnSelectBtnClick;
            btn.Size         = new Vector2(100, Size.y);
            _name2Context.Add(btn, pop);
            HorList.AddItem(btn);
        }
Exemplo n.º 2
0
        public void RemvoeItem(string name)
        {
            EditorButton btn = GetBtnWithName(name);

            if (btn == null)
            {
                return;
            }

            HorList.RemoveItem(btn);
            _name2Context.Remove(btn);
        }
        public void AddItem(int treeFlag)
        {
            EditorButton btn = NodeFactoryXML.CreateEditorControl <EditorButton>();

            btn.DefaultStyle = true;
            btn.Style        = EditorStyles.miniButton;
            btn.Size         = new Vector2(Size.x, 30);
            int index = AutoList.Count;

            btn.Content = $"{index}";
            AutoList.AddItem(btn);
            btn.OnBtnClick = b => { FrameSelected?.Invoke(treeFlag, int.Parse(b.Content.ToString()), this); };
        }
Exemplo n.º 4
0
        public void Remove(object data)
        {
            _objCallBack.Remove(data);
            EditorButton btn = _buttons[data];

            _buttons.Remove(data);
            btn.Dispose();

            int index = 0;

            foreach (EditorButton b in _buttons.Values)
            {
                b.LocalPosition = new Vector2(0, BTN_SIZE.y * index++);
            }
            ReCalu();
        }
Exemplo n.º 5
0
        public void AddMenu(object data, Action <object> callBack)
        {
            _objCallBack.Add(data, callBack);
            EditorButton btn = NodeFactoryXML.CreateEditorControl <EditorButton>();

            btn.OnBtnClick = (curBtn) => { SetParent(null); _objCallBack[curBtn.Content](curBtn.Content); };
            btn.SetParent(this);
            btn.Size          = BTN_SIZE;
            btn.Content       = data;
            btn.LocalPosition = new Vector2(0, BTN_SIZE.y * _buttons.Count);

            btn.Style        = "Button";
            btn.DefaultStyle = true;

            _buttons.Add(data, btn);
            ReCalu();
        }
Exemplo n.º 6
0
        private void Show()
        {
            while (_selectionButtons.Count < _showStr.Length)
            {
                _selectionButtons.Add(CreateButton(_selectionButtons.Count));
            }

            for (int i = 0; i < _selectionButtons.Count; ++i)
            {
                EditorButton button = _selectionButtons[i];
                if (_showStr.Length <= i)
                {
                    button.Active = false;
                    continue;
                }
                button.Active = true;
                NodeParam str = _showStr[i];
                button.Content = str;
            }
        }
Exemplo n.º 7
0
        private EditorButton CreateButton(int index)
        {
            EditorButton button = NodeFactoryXML.CreateEditorControl <EditorButton>();

            button.Size = new Vector2(275, 30);
            button.SetParent(DataButton);
            button.LocalPosition = new Vector2(5, 30 * index);
            button.OnBtnClick    = (e) =>
            {
                Type type = (button.Content as NodeParam).NodeType;
                if (_isAdd)
                {
                    OnAddSelected?.Invoke(type);
                }
                else
                {
                    OnChangeSelected?.Invoke(type);
                }
                Active = false;
            };
            return(button);
        }
Exemplo n.º 8
0
        private void OnSelectBtnClick(EditorButton obj)
        {
            EditorPopupMenu menu = _name2Context[obj];

            EditorControlDragEventManager.Instance.PopupMenu(this, menu, obj.RootPosition + new Vector2(0, obj.Size.y));
        }