public static void ShowDialog()
    {
        //创建窗口
        Rect wr = new Rect(0, 0, 500, 220);
        NGUIDepthInstruction window = (NGUIDepthInstruction)EditorWindow.GetWindowWithRect(typeof(NGUIDepthInstruction), wr, true, "Depth分段说明");

        window.Show();
    }
Beispiel #2
0
    /// <summary>
    /// Draw the custom wizard.
    /// </summary>

    void OnGUI()
    {
        mScroll = GUILayout.BeginScrollView(mScroll);

        GameObject      tempPanel = null;
        bool            bBegin    = false;
        bool            bOpen     = false;
        EAtlasLayers    tempLayer = EAtlasLayers.Common_1;
        ItemDepthConfig tempConfig;

        for (int i = 0; i < _allItemsConfig.Count; i++)
        {
            tempConfig = _allItemsConfig[i];
            if ((tempPanel != null && tempPanel != tempConfig.panel) || (tempPanel != null && tempLayer != tempConfig.belongTo))
            {
                if (bBegin)
                {
                    NGUIEditorTools.EndContents();
                }
                bBegin = false;
            }

            if (tempPanel == null || tempPanel != tempConfig.panel)
            {
                DrawOnePanelName(tempConfig.panel);
            }
            if (tempPanel == null || tempLayer != tempConfig.belongTo)
            {
                //DrawOneTitle(tempConfig);
                string sTitle = GetLayerName(tempConfig.belongTo);
                string sKey   = tempConfig.panel.name + tempConfig.belongTo.ToString();
                bOpen = NGUIEditorTools.DrawHeader(sTitle, sKey);
                if (bOpen)
                {
                    NGUIEditorTools.BeginContents();
                    bBegin = true;
//                     GUILayout.BeginHorizontal();
//                     GUILayout.FlexibleSpace();
//                     bool bClick = GUILayout.Button("重置选中项depth", "LargeButton", GUILayout.Width(160f), GUILayout.Height(25f));
//                     if (bClick)
//                     {
//                         int layers = 1 << (int)tempConfig.belongTo;
//
//                         count_common1 = 0;
//                         count_common2 = 0;
//                         count_common3 = 0;
//                         count_uiatlas = 0;
//                         EachChildrenDepth(tempConfig.panel, tempConfig.panel, layers, true, true);
//                         SortAllItems();
//                     }
//                     GUILayout.FlexibleSpace();
//                     GUILayout.EndHorizontal();
                }
                else
                {
                    bBegin = false;
                }
            }
            if (bBegin)
            {
                DrawOneItem(ref tempConfig);
            }

            tempPanel = tempConfig.panel;
            tempLayer = tempConfig.belongTo;
        }
        if (bBegin)
        {
            NGUIEditorTools.EndContents();
        }

        GUILayout.EndScrollView();
        GUILayout.Space(6f);
        GUILayout.BeginHorizontal();
        GUILayout.Space(6f);
        bool bSelect = EditorGUILayout.ToggleLeft("选中所有", bSelectAll, GUILayout.Width(60f));

        if (bSelectAll != bSelect)
        {
            if (bSelect)
            {
                SelectAllItem();
            }
            else
            {
                UnSelectAllItem();
            }
            bSelectAll = bSelect;
        }
        GUILayout.FlexibleSpace();
        bool change = GUILayout.Button("自动适配所有选中项", "LargeButton", GUILayout.Width(160f));

        if (change)
        {
            SetChildrenDepth();
            ReadAllChildrenDepth();
        }
        GUILayout.FlexibleSpace();
        GUILayout.Space(-90f);
        bool bClickInstruction = GUILayout.Button("分段说明", "LargeButton", GUILayout.Width(90f));

        if (bClickInstruction)
        {
            NGUIDepthInstruction.ShowDialog();
        }
        GUILayout.EndHorizontal();
        GUILayout.Space(10f);
    }