Beispiel #1
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();
        }
Beispiel #2
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);
        }