Exemplo n.º 1
0
        void LabelGUI()
        {
            EditorGUILayout.BeginHorizontal();
            {
                var curToggles = new bool[6];
                footerToggle.CopyTo(curToggles, 0);

                curToggles[0]       = GUILayout.Toggle(curToggles[0], "all", EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(1);
                curToggles[1]       = GUILayout.Toggle(curToggles[1], UnityEditorMemoPrefs.Label1, EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(2);
                curToggles[2]       = GUILayout.Toggle(curToggles[2], UnityEditorMemoPrefs.Label2, EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(3);
                curToggles[3]       = GUILayout.Toggle(curToggles[3], UnityEditorMemoPrefs.Label3, EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(4);
                curToggles[4]       = GUILayout.Toggle(curToggles[4], UnityEditorMemoPrefs.Label4, EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(5);
                curToggles[5]       = GUILayout.Toggle(curToggles[5], UnityEditorMemoPrefs.Label5, EditorStyles.toolbarButton);
                GUI.backgroundColor = Color.white;
                var label = WindowHelper.ChangeFooterStatus(selectLabel, ref curToggles);
                if (label != selectLabel)
                {
                    UndoHelper.WindowUndo(UndoHelper.UNDO_CHANGE_LABEL);   // avoid error. why? :(
                    postMemoLabel            = label;
                    selectLabel              = label;
                    memoTreeView.SelectLabel = ( UnityEditorMemoLabel )selectLabel;
                    memoTreeView.Reload();
                    GUIUtility.keyboardControl = 0;
                }
                footerToggle = curToggles;
            }
            EditorGUILayout.EndHorizontal();
        }
Exemplo n.º 2
0
        void Footer()
        {
            GUILayout.FlexibleSpace();
            EditorGUILayout.BeginHorizontal();
            {
                var curToggles = new bool[6];
                footerToggle.CopyTo(curToggles, 0);

                curToggles[0]       = GUILayout.Toggle(curToggles[0], "all", EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(1);
                curToggles[1]       = GUILayout.Toggle(curToggles[1], WindowHelper.Data.LabelTag[0], EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(2);
                curToggles[2]       = GUILayout.Toggle(curToggles[2], WindowHelper.Data.LabelTag[1], EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(3);
                curToggles[3]       = GUILayout.Toggle(curToggles[3], WindowHelper.Data.LabelTag[2], EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(4);
                curToggles[4]       = GUILayout.Toggle(curToggles[4], WindowHelper.Data.LabelTag[3], EditorStyles.toolbarButton);
                GUI.backgroundColor = GUIHelper.Colors.LabelColor(5);
                curToggles[5]       = GUILayout.Toggle(curToggles[5], WindowHelper.Data.LabelTag[4], EditorStyles.toolbarButton);
                GUI.backgroundColor = Color.white;
                var label = WindowHelper.ChangeFooterStatus(selectLabel, ref curToggles);
                if (label != selectLabel)
                {
                    //Undo.IncrementCurrentGroup();
                    //UndoHelper.WindowUndo( UndoHelper.UNDO_CHANGE_LABEL ); // avoid error. why? :(
                    postMemoLabel = label;
                    GUIUtility.keyboardControl = 0;
                }
                selectLabel  = label;
                footerToggle = curToggles;
            }
            EditorGUILayout.EndHorizontal();
        }
        private void labelSelectionGUI(Rect rect)
        {
            var curToggles = new bool[6];

            footerToggle.CopyTo(curToggles, 0);

            rect.width  = rect.width / 6;
            rect.height = 15f;

            GUI.backgroundColor = Color.white;
            curToggles[0]       = GUI.Toggle(rect, curToggles[0], "", GUIHelper.Styles.LargeButtonLeft);
            rect.x += rect.width;
            GUI.backgroundColor = GUIHelper.Colors.LabelColor(1);
            curToggles[1]       = GUI.Toggle(rect, curToggles[1], "", GUIHelper.Styles.LargeButtonMid);
            rect.x += rect.width;
            GUI.backgroundColor = GUIHelper.Colors.LabelColor(2);
            curToggles[2]       = GUI.Toggle(rect, curToggles[2], "", GUIHelper.Styles.LargeButtonMid);
            rect.x += rect.width;
            GUI.backgroundColor = GUIHelper.Colors.LabelColor(3);
            curToggles[3]       = GUI.Toggle(rect, curToggles[3], "", GUIHelper.Styles.LargeButtonMid);
            rect.x += rect.width;
            GUI.backgroundColor = GUIHelper.Colors.LabelColor(4);
            curToggles[4]       = GUI.Toggle(rect, curToggles[4], "", GUIHelper.Styles.LargeButtonMid);
            rect.x += rect.width;
            GUI.backgroundColor = GUIHelper.Colors.LabelColor(5);
            curToggles[5]       = GUI.Toggle(rect, curToggles[5], "", GUIHelper.Styles.LargeButtonRight);
            rect.x += rect.width;
            GUI.backgroundColor = Color.white;
            var label = ( UnityEditorMemoLabel )WindowHelper.ChangeFooterStatus((int)Label, ref curToggles);

            if (label != Label)
            {
                UndoHelper.EditorMemoUndo(UndoHelper.UNDO_CHANGE_LABEL);
                Label = label;
            }
            footerToggle = curToggles;
        }