void HandleInput()
    {
        Event curEvent = Event.current;

        GUILayout.Label("Mouse pos " + curEvent.mousePosition);
        if (curEvent != null && curEvent.type != EventType.Repaint)
        {
            #region  标左键按下
            if (curEvent.isMouse && curEvent.button == 0 && curEvent.type == EventType.MouseDown)
            {
                for (int i = 0; i < CurLogicTree.nodeList.Count; i++)
                {
                    LogicNode node = CurLogicTree.nodeList[i];
                    if (node.IsUiHit(curEvent.mousePosition))
                    {
                        dragFlag           = DragFlag.NodeFrame;
                        curDragControlNode = node;
                        curSelectedNode    = node;
                        curEvent.Use();
                        return;
                    }

                    if (node.inputRect.Contains(curEvent.mousePosition))
                    {
                        //如果是已经有父节点了,就暂时移除父节点对这个节点的连接,如果放开位置还在这个输入区就会重新连上,不在的话就是移除
                        if (node.parentNode)
                        {
                            dragFlag           = DragFlag.OutputNode;
                            curDragControlNode = node.parentNode;
                            node.parentNode.RemoveLink(node);
                        }
                        else   //没有选中就等着连接到其他的输出区
                        {
                            dragFlag           = DragFlag.InputNode;
                            curDragControlNode = node;
                        }
                        curEvent.Use();
                        return;
                    }

                    if (node.outPutRect.Contains(curEvent.mousePosition))
                    {
                        dragFlag           = DragFlag.OutputNode;
                        curDragControlNode = node;
                        curEvent.Use();
                        return;
                    }
                }

                //没有合适的选中,就是node
                dragFlag           = DragFlag.None;
                curDragControlNode = null;
            }
            #endregion


            #region  标左键抬起
            if (curEvent.isMouse && curEvent.button == 0 && curEvent.type == EventType.MouseUp)
            {
                for (int i = 0; i < CurLogicTree.nodeList.Count; i++)
                {
                    LogicNode node = CurLogicTree.nodeList[i];
                    if (node == curDragControlNode) //不用处理跟按下的时候相同的节点
                    {
                        continue;
                    }
                    if (dragFlag == DragFlag.InputNode) //按下时候记录的是拖动节点的输入,我们就只关心是不是在其它节点的输出放开
                    {
                        if (node.outPutRect.Contains(curEvent.mousePosition))
                        {
                            node.AddLink(curDragControlNode);
                            Repaint();
                            break;
                        }
                    }
                    else if (dragFlag == DragFlag.OutputNode) //按下的是节点输出,只需要关注是不是输入节点
                    {
                        if (node.inputRect.Contains(curEvent.mousePosition))
                        {
                            curDragControlNode.AddLink(node);
                            break;
                        }
                    }
                }

                //没有合适的选中,就是node
                dragFlag           = DragFlag.None;
                curDragControlNode = null;
            }
            #endregion



            #region  标右键拖动
            if (curEvent.isMouse && curEvent.button == 1 && curEvent.type == EventType.MouseDrag)
            {
                for (int i = 0; i < CurLogicTree.nodeList.Count; i++)
                {
                    LogicNode node = CurLogicTree.nodeList[i];
                    node.Position += curEvent.delta;
                }
                Repaint();
            }
            #endregion


            #region  标左键拖动
            if (curEvent.isMouse && curEvent.button == 0 && curEvent.type == EventType.MouseDrag)
            {
                if (dragFlag == DragFlag.NodeFrame && curDragControlNode.IsUiHit(curEvent.mousePosition))
                {
                    curDragControlNode.Position += curEvent.delta;
                    curEvent.Use();
                    Repaint();
                }
            }
            #endregion
        }
    }