//通过显示数据 画所有内容
    void DrawRects()
    {
        if (displayNodeList.Count < 1)
        {
            GUI.Label(subWindowRect, new GUIContent("No Command Data", parentWindow.hintTexture), FduEditorGUI.getTitleStyle_LevelOne());
        }

        //根据生成的显示数据 画每一个节点
        foreach (displayNode dis in displayNodeList)
        {
            GUI.DrawTexture(new Rect(dis.position.x + dis.position.width * 0.5f * (1 - scale), dis.position.y + dis.position.height * 0.5f * (1 - scale),
                                     dis.position.width * scale, dis.position.height * scale), rectTexture[(int)dis.color]);

            if (scale >= 1.0f)                            //缩放完成后显示Label
            {
                if (dis.state == displayNodeState.normal) //可以正常显示的节点显示信息
                {
                    GUI.Label(dis.position, getShowMessage(dis.nodeData), labelStyle);
                }
                else
                {
                    GUI.Label(dis.position, dis.hideIndex.ToString(), labelStyle);//显示不了的节点显示index 可以由用户通过index查找到对应信息
                }
            }
        }

        //画左侧的颜色标识标签
        GUI.DrawTexture(colorHintLabelPos, colorHintLabelTexture);
        GUI.Label(new Rect(colorHintLabelPos.x, colorHintLabelPos.y - 20, 100, 20), "Rasied Times");
        float interval = colorHintLabelPos.height / (int)colorLevel.Others;

        float x = colorHintLabelPos.x + colorHintLabelPos.width + 5;
        float y = colorHintLabelPos.y + colorHintLabelPos.height - interval * 0.5f;

        GUI.Label(new Rect(x, y, 100, 20), "0~" + (int)colorStep[0]);
        //为每一个颜色添加标签
        for (int i = 1; i < (int)colorLevel.Others; ++i)
        {
            x = colorHintLabelPos.x + colorHintLabelPos.width + 5;
            y = colorHintLabelPos.y + colorHintLabelPos.height - interval * 0.5f - i * interval;
            if (((int)colorStep[i - 1]) < ((int)colorStep[i]))
            {
                GUI.Label(new Rect(x, y, 100, 20), ((int)colorStep[i - 1]) + 1 + "~" + ((int)colorStep[i]));
            }
            else
            {
                GUI.Label(new Rect(x, y, 100, 20), "None");
            }
        }
        var detailStyle = FduEditorGUI.getWordWarp();

        //画下方的Detail部分
        if (hideIndexCount > 0 && scale >= 1.0f)
        {
            GUI.Box(detailScrollPos, "");
            scrollPos = GUI.BeginScrollView(detailScrollPos, scrollPos, new Rect(0, 0, detailScrollPos.width, detailHeight));
            var content = new GUIContent("");
            detailHeight = 0.0f;
            foreach (displayNode dis in displayNodeList)
            {
                if (dis.state != displayNodeState.normal)
                {
                    content.text = dis.getHideInfoString();
                    GUI.Label(new Rect(10, detailHeight, detailScrollPos.width - 10, 15), content, detailStyle); //启动换行了 那么Rect的height形同虚设
                    detailHeight += detailStyle.CalcHeight(content, detailScrollPos.width - 10);
                }
            }
            if (noExecutorCommandList.Count > 0)
            {
                string noExecutorInfo = "No Executor Commands: " + noExecutorCommandList[0];
                for (int i = 1; i < noExecutorCommandList.Count; ++i)
                {
                    noExecutorInfo += ", " + noExecutorCommandList[i];
                }
                content.text = noExecutorInfo;
                GUI.Label(new Rect(10, detailHeight, detailScrollPos.width - 10, 15), content, detailStyle);
                detailHeight += detailStyle.CalcHeight(content, detailScrollPos.width - 10);
            }
            GUI.EndScrollView();
        }
    }
    //绘制窗口
    public override void DrawSubWindow()
    {
        var leftOffset = new GUIStyle();

        leftOffset.margin.left = 10;

        if (!Application.isPlaying)
        {
            GUI.Label(subWindowRect, new GUIContent("You can get the information of cluster Commands at run time", parentWindow.hintTexture), FduEditorGUI.getTitleStyle_LevelOne());
            return;
        }

        //==========================================搜索与总数部分Start===================================
        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal(leftOffset, GUILayout.Width(subWindowRect.width));
        EditorGUILayout.LabelField("Cached Command Count ", ClusterCommandStatisticClass.instance.getCommandCount().ToString(), leftOffset);
        EditorGUILayout.EndHorizontal();

        //画两个Box 上面用于列表 下面用于详细内容
        GUI.Box(CommandScroll, "");
        GUI.Box(detailScroll, "");

        EditorGUILayout.BeginHorizontal(leftOffset, GUILayout.Width(subWindowRect.width));


        searchText_Command = (string)EditorGUILayout.TextField("Search", searchText_Command, GUILayout.Width(subWindowRect.width * 0.5f), GUILayout.Height(20)).Clone();

        EditorGUILayout.Space();
        if (GUILayout.Button("Clear", GUILayout.Height(21)))
        {
            Debug.Log("click clear");
            searchText_Command = "";
            searchingFlag      = false;
            EditorGUI.FocusTextInControl("");
        }
        if (GUILayout.Button("Search", GUILayout.Height(21)))
        {
            searchingFlag = true;
            EditorGUI.FocusTextInControl("");
        }
        EditorGUILayout.EndHorizontal();
        //==========================================搜索与总数部分End===================================


        if (ClusterCommandStatisticClass.instance.getCommandCount() <= 0)
        {
            GUI.Label(CommandScroll, new GUIContent("No Cached Command", parentWindow.hintTexture), FduEditorGUI.getTitleStyle_LevelOne());
        }

        //==========================================Command列表部分Start===================================
        leftOffset.margin.left += 15;

        float len1, len2, len3, len4, len5;

        len1 = CommandScroll.width * 0.25f;
        len2 = CommandScroll.width * 0.07f;
        len3 = CommandScroll.width * 0.07f;
        len4 = CommandScroll.width * 0.43f;
        len5 = CommandScroll.width * 0.1f;

        var labelStyle = new GUIStyle();

        labelStyle.fontStyle = FontStyle.Bold;

        EditorGUILayout.Space();
        EditorGUILayout.BeginHorizontal(leftOffset, GUILayout.Width(subWindowRect.width));
        EditorGUILayout.LabelField("Command Name", labelStyle, GUILayout.Width(len1));
        EditorGUILayout.LabelField("Frame", labelStyle, GUILayout.Width(len2));
        EditorGUILayout.LabelField("Parameter Count And Names", labelStyle, GUILayout.Width(len3 * 5));
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        int listCount = 0;

        CommandScrollPos = EditorGUILayout.BeginScrollView(CommandScrollPos, leftOffset, GUILayout.Width(CommandScroll.width - 10), GUILayout.Height(CommandScroll.height - 10));


        var    enu = ClusterCommandStatisticClass.instance.getStatisticCommandData();
        string CommandName;

        while (enu.MoveNext())
        {
            CommandName = enu.Current.e.getCommandName();
            if (!searchingFlag || checkSearchText(CommandName))
            {
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(CommandName, GUILayout.Width(len1));
                EditorGUILayout.LabelField(enu.Current.frameCount.ToString(), GUILayout.Width(len2));
                EditorGUILayout.LabelField(enu.Current.e.getParameterCount().ToString(), GUILayout.Width(len3));
                EditorGUILayout.LabelField(getCommandParameters(enu.Current.e), GUILayout.Width(len4));
                if (GUILayout.Button("Check", GUILayout.Width(len5)))
                {
                    detailData = new ClusterCommandShowData(enu.Current.e, enu.Current.frameCount);
                }
                EditorGUILayout.EndHorizontal();
                listCount++;
            }
        }

        //为了强制显示scroll view 的进度条 BeginScrollView里面的alwaysShowVertical参数没用
        for (int i = listCount; i < 22; ++i)
        {
            EditorGUILayout.LabelField("");
        }

        EditorGUILayout.EndScrollView();
        //==========================================Command列表部分End===================================

        //==========================================Command detail 部分===================================
        if (detailData == null)
        {
            GUI.Label(detailScroll, new GUIContent("No Selected Command", parentWindow.hintTexture), FduEditorGUI.getTitleStyle_LevelOne());
            return;
        }

        leftOffset.margin.top = 25;
        detailScrollPos       = EditorGUILayout.BeginScrollView(detailScrollPos, leftOffset, GUILayout.Width(detailScroll.width - 10), GUILayout.Height(detailScroll.height - 10));


        EditorGUILayout.LabelField("CommandName: " + detailData.e.getCommandName() + " Raised Frame: " + detailData.frameCount + " Parameter Count: " + detailData.e.getParameterCount(), GUILayout.Width(detailScroll.width - 50.0f));

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("Parameter Name", GUILayout.Width(detailScroll.width * 0.3f));
        EditorGUILayout.LabelField("Parameter Value", GUILayout.Width(detailScroll.width * 0.3f));
        EditorGUILayout.EndHorizontal();

        var paraMap = detailData.e.getMapEnumerator();

        while (paraMap.MoveNext())
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(paraMap.Current.Key, GUILayout.Width(detailScroll.width * 0.3f));
            EditorGUILayout.LabelField(paraMap.Current.Value.ToString(), GUILayout.Width(detailScroll.width * 0.3f));
            EditorGUILayout.EndHorizontal();
        }

        var collMap = detailData.e.getCollectionsMapEnumerator();

        while (collMap.MoveNext())
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(collMap.Current.Key, GUILayout.Width(detailScroll.width * 0.3f));
            string collectorInfo = getCollectionInfo(collMap.Current.Value);
            EditorGUILayout.LabelField(collectorInfo, FduEditorGUI.getWordWarp(), GUILayout.Width(detailScroll.width * 0.6f));
            EditorGUILayout.EndHorizontal();
        }

        //for (int i = 0; i < 10; ++i)
        //{
        //    EditorGUILayout.BeginHorizontal();
        //    EditorGUILayout.LabelField("Observer GameObject name", GUILayout.Width(detailScroll.width * 0.3f));
        //    EditorGUILayout.LabelField("FduTransformObserver", GUILayout.Width(detailScroll.width * 0.3f));
        //    EditorGUILayout.EndHorizontal();
        //}

        EditorGUILayout.EndScrollView();
        //==========================================Command detail 部分===================================
    }