public NodeDataInfoPanel()
 {
     Active = false;
     OnMouseClick.Add(UseEvent);
     OnRightClick.Add(UseEvent);
     OnMouseDown.Add(UseEvent);
 }
Beispiel #2
0
        public override void InitFinish()
        {
            base.InitFinish();
            FilterField.OnContentChange = () => { OnContentChange(); };
            OnMouseClick.Add((c, e) => e.Use());

            FilterField.Editable      = true;
            FilterField.Content       = "";
            FilterField.Color         = Color.gray;
            FilterField.TextFontStyle = FontStyle.BoldAndItalic;
        }
 public EditorButton()
 {
     _localSize = new Rect(Vector2.zero, Size);
     OnSizeChange.Add(OnRectChange);
     _bg     = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Editor/Resources/NodeSelectBtn.png");
     _hover  = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Editor/Resources/NodeSelectBtnHover.png");
     _onDown = AssetDatabase.LoadAssetAtPath <Texture2D>("Assets/Editor/Resources/NodeSelectBtnDown.png");
     OnMouseClick.Add((c, e) =>
     {
         e.Use();
     });
     InitStyle();
 }
Beispiel #4
0
        public TreeNodeCanvas()
        {
            OnMouseClick.Add(MouseClick);
            OnMouseDown.Add((k, e) =>
            {
                if (e.Event.button == 2 || e.Event.button == 1)
                {
                    _down = true;
                }
            });

            OnMouseUp.Add((k, e) =>
            {
                if (e.Event.button == 2 || e.Event.button == 1)
                {
                    _down = false;
                }
            });
            OnKeyDown.Add((k, e) =>
            {
                switch (e.Event.keyCode)
                {
                case KeyCode.Delete:
                    BeTreeNode node = _curSelected;
                    if (_curSelected == null)
                    {
                        return;
                    }
                    DeleteItem(node);
                    break;

                case KeyCode.Escape:
                    if (_curSelected != null)
                    {
                        SelectedNode(null);
                        break;
                    }
                    if (EditorUtility.DisplayDialog("Close window", "You will lose all the unsafed data.", "Confirm", "Cancel"))
                    {
                        (Root as EditorWindow).Close();
                    }
                    break;

                case KeyCode.S:
                    if (e.Event.control)
                    {
                        if (e.Event.alt)
                        {
                            OnSaveToJson?.Invoke();
                        }
                        else
                        {
                            OnSave?.Invoke();
                        }
                    }
                    break;

                case KeyCode.O:
                    if (e.Event.control && e.Event.alt)
                    {
                        OpenPanel();
                    }
                    break;

                case KeyCode.N:
                    if (e.Event.control && e.Event.alt)
                    {
                        if (!e.Event.shift)
                        {
                            CreatePanel("prefab");
                        }
                        else
                        {
                            CreatePanel("txt");
                        }
                    }
                    break;
                }
            });
        }