public virtual Rect DrawNode(Node node)
        {
            GUIContent guic = new GUIContent(node.desc, NodeFlowDrawHelper.CreateTagTex(node.color, node.color, 8, 8));
            Rect       rect = GUI.Window(node.id, node.rect, NodeFlowDrawHelper.NodeWindow, guic);

            return(rect);
        }
        public virtual void DrawInNodeList()
        {
            Texture2D  texture = NodeFlowDrawHelper.CreateTagTex(color, color, 6, 6);
            GUIContent guic    = new GUIContent(this.desc, texture);

            if (GUILayout.Button(guic, GUILayout.Width(160), GUILayout.Height(30)))
            {
                OperCmdInfo cmdInfo = new OperCmdInfo();
                cmdInfo.cmd   = OperCmd.CREATE_NODE;
                cmdInfo.param = this;
                NodeFlowEditorWindow.instance.AddCmd(cmdInfo);
            }
        }
        void OnGUI()
        {
            //command button
            {
                Rect rect = new Rect(0, 0, position.width, commandHeight);
                GUILayout.BeginArea(rect);
                GUI.Box(new Rect(0, 0, rect.width, rect.height), "");
                GUILayout.BeginHorizontal();

                if (GUILayout.Button("文件列表", GUILayout.Width(95), GUILayout.Height(30)))
                {
                    isFileListMode = true;
                }
                if (GUILayout.Button("节点列表", GUILayout.Width(95), GUILayout.Height(30)))
                {
                    isFileListMode = false;
                }
                GUILayout.Label("  ", GUILayout.Width(30), GUILayout.Height(30));
                if (GUILayout.Button("创建空NodeFlow", GUILayout.Width(130), GUILayout.Height(30)))
                {
                    OperCmdInfo cmdInfo = new OperCmdInfo();
                    cmdInfo.cmd = OperCmd.CREATE_NEW;
                    NodeFlowEditorWindow.instance.AddCmd(cmdInfo);
                }
                if (GUILayout.Button("保存NodeFlow", GUILayout.Width(130), GUILayout.Height(30)))
                {
                    OperCmdInfo cmdInfo = new OperCmdInfo();
                    cmdInfo.cmd = OperCmd.SAVE_FILE;
                    NodeFlowEditorWindow.instance.AddCmd(cmdInfo);
                }
                if (editorMode.IsNewNodeFlow())
                {
                    GUI.FocusControl("-1");
                }
                if (editorMode.mCurrent != null)
                {
                    string flowName = "文件名:";
                    editorMode.mCurrent.name = EditorGUILayout.TextField(flowName, editorMode.mCurrent.name);

                    if (GUILayout.Button("打开所在文件夹", GUILayout.Width(150), GUILayout.Height(30)))
                    {
                        string path = editorMode.mCurrent.name;

                        if (path.Length == 0)
                        {
                            path = filesList.GetDirRoot(edtorName);
                        }
                        else
                        {
                            path = path.Replace("/", "\\");
                            int idx = path.LastIndexOf("\\");
                            path = path.Substring(0, idx);
                        }
                        System.Diagnostics.Process.Start("explorer", path);
                    }
                }
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }

            //file list view
            {
                Rect rect = new Rect(0, commandHeight, leftWidth, position.height - commandHeight);
                GUILayout.BeginArea(rect);
                GUI.Box(new Rect(0, 0, rect.width, rect.height), "");
                GUILayout.BeginVertical();
                fileListViewPos = EditorGUILayout.BeginScrollView(fileListViewPos, GUILayout.Width(rect.width), GUILayout.Height(rect.height));
                if (isFileListMode)
                {
                    filesList.Layout();
                }
                else
                {
                    NodeListLayoutHelper.Layout(nodeDef);
                }
                EditorGUILayout.EndScrollView();
                GUILayout.EndVertical();
                GUILayout.EndArea();
            }

            //property view
            {
                Rect rect = new Rect(position.width - rightWidth, commandHeight, rightWidth, position.height - commandHeight);
                GUILayout.BeginArea(rect);
                GUI.Box(new Rect(0, 0, rect.width, rect.height), "");
                GUILayout.BeginVertical();
                propertyViewPos = EditorGUILayout.BeginScrollView(propertyViewPos, GUILayout.Width(rect.width), GUILayout.Height(rect.height));
                editorMode.ShowProperty(selectedNodeId);
                EditorGUILayout.EndScrollView();
                GUILayout.EndVertical();
                GUILayout.EndArea();
            }

            //nodeflow view
            {
                float skillFlowWidth = position.width - leftWidth - rightWidth;
                Rect  rect           = new Rect(leftWidth, commandHeight, skillFlowWidth, position.height - commandHeight);
                GUILayout.BeginArea(rect);
                GUI.Box(new Rect(0, 0, rect.width, rect.height), "");
                GUILayout.BeginHorizontal();
                nodeFlowViewPos = EditorGUILayout.BeginScrollView(nodeFlowViewPos, GUILayout.Width(rect.width), GUILayout.Height(rect.height));
                GUILayout.Label("", GUILayout.Width(rect.width * 3), GUILayout.Height(rect.height * 3));
                BeginWindows();
                editorMode.Draw();
                //link
                if (curNextNode != null)
                {
                    Vector2 start = curNextNode.rect.center;
                    start.x += curNextNode.parent.rect.left;
                    start.y += curNextNode.parent.rect.top;
                    Vector2       end = curMouseEndPos;
                    ConnectionDef def = curNextNode.connectDef;
                    Color         c   = def != null ? def.color : Color.white;
                    NodeFlowDrawHelper.DrawLine(start, end, c);
                }
                EndWindows();
                EditorGUILayout.EndScrollView();
                GUILayout.EndHorizontal();
                GUILayout.EndArea();
            }
            OnDoEnevent();
        }
 public void Draw()
 {
     NodeFlowDrawHelper.DrawFlow(mCurrent);
 }