protected void DrawSortingLayer()
        {
            Undo.RecordObject(m_Renderer, "Sorting Layer Change");

            EditorGUI.BeginChangeCheck();

            // SORTING LAYERS
            var sortingLayerNames = SortingLayerHelper.sortingLayerNames;

            var textComponent = (TextMeshPro)m_TextComponent;

            // Look up the layer name using the current layer ID
            string oldName = SortingLayerHelper.GetSortingLayerNameFromID(textComponent.sortingLayerID);

            // Use the name to look up our array index into the names list
            int oldLayerIndex = System.Array.IndexOf(sortingLayerNames, oldName);

            // Show the pop-up for the names
            EditorGUIUtility.fieldWidth = 0f;
            int newLayerIndex = EditorGUILayout.Popup(k_SortingLayerLabel, oldLayerIndex, sortingLayerNames);

            // If the index changes, look up the ID for the new index to store as the new ID
            if (newLayerIndex != oldLayerIndex)
            {
                textComponent.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(newLayerIndex);
            }

            // Expose the manual sorting order
            int newSortingLayerOrder = EditorGUILayout.IntField(k_OrderInLayerLabel, textComponent.sortingOrder);

            if (newSortingLayerOrder != textComponent.sortingOrder)
            {
                textComponent.sortingOrder = newSortingLayerOrder;
            }

            if (EditorGUI.EndChangeCheck())
            {
                m_HavePropertiesChanged = true;
            }

            EditorGUILayout.Space();
        }
        public override void OnInspectorGUI()
        {
            EditorGUI.indentLevel = 0;

            GUI.enabled = false;
            EditorGUILayout.PropertyField(fontAsset_prop);
            EditorGUILayout.PropertyField(spriteAsset_prop);
            GUI.enabled = true;

            EditorGUI.BeginChangeCheck();

            // SORTING LAYERS
            var sortingLayerNames = SortingLayerHelper.sortingLayerNames;

            // Look up the layer name using the current layer ID
            string oldName = SortingLayerHelper.GetSortingLayerNameFromID(m_Renderer.sortingLayerID);

            // Use the name to look up our array index into the names list
            int oldLayerIndex = System.Array.IndexOf(sortingLayerNames, oldName);

            // Show the pop-up for the names
            int newLayerIndex = EditorGUILayout.Popup("Sorting Layer", oldLayerIndex, sortingLayerNames);

            // If the index changes, look up the ID for the new index to store as the new ID
            if (newLayerIndex != oldLayerIndex)
            {
                //Undo.RecordObject(renderer, "Edit Sorting Layer");
                m_Renderer.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(newLayerIndex);
                //EditorUtility.SetDirty(renderer);
            }

            // Expose the manual sorting order
            int newSortingLayerOrder = EditorGUILayout.IntField("Order in Layer", m_Renderer.sortingOrder);

            if (newSortingLayerOrder != m_Renderer.sortingOrder)
            {
                //Undo.RecordObject(renderer, "Edit Sorting Order");
                m_Renderer.sortingOrder = newSortingLayerOrder;
            }
        }
예제 #3
0
        public override void OnInspectorGUI()
        {
            EditorGUI.indentLevel = 0;
            if (GUILayout.Button("<b>SUB OBJECT SETTINGS</b>" + (m_foldout.fontSettings ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
            {
                m_foldout.fontSettings = !m_foldout.fontSettings;
            }
            if (m_foldout.fontSettings)
            {
                GUI.enabled = false;
                EditorGUILayout.PropertyField(fontAsset_prop);
                EditorGUILayout.PropertyField(spriteAsset_prop);
                GUI.enabled = true;
            }
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Sorting Layer");
            EditorGUI.BeginChangeCheck();
            string[] sortingLayerNames      = SortingLayerHelper.sortingLayerNames;
            string   sortingLayerNameFromID = SortingLayerHelper.GetSortingLayerNameFromID(m_Renderer.sortingLayerID);
            int      num = Array.IndexOf(sortingLayerNames, sortingLayerNameFromID);

            EditorGUIUtility.fieldWidth = 0f;
            int num2 = EditorGUILayout.Popup(string.Empty, num, sortingLayerNames, GUILayout.MinWidth(80f));

            if (num2 != num)
            {
                m_Renderer.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(num2);
            }
            EditorGUIUtility.labelWidth = 40f;
            EditorGUIUtility.fieldWidth = 80f;
            int num3 = EditorGUILayout.IntField("Order", m_Renderer.sortingOrder);

            if (num3 != m_Renderer.sortingOrder)
            {
                m_Renderer.sortingOrder = num3;
            }
            EditorGUILayout.EndHorizontal();
        }
예제 #4
0
        public override void OnInspectorGUI()
        {
            // Copy Default GUI Toggle Style
            if (toggleStyle == null)
            {
                toggleStyle                  = new GUIStyle(GUI.skin.label);
                toggleStyle.fontSize         = 12;
                toggleStyle.normal.textColor = TMP_UIStyleManager.Section_Label.normal.textColor;
                toggleStyle.richText         = true;
            }


            serializedObject.Update();

            Rect  rect       = EditorGUILayout.GetControlRect(false, 25);
            float labelWidth = EditorGUIUtility.labelWidth = 130f;
            float fieldWidth = EditorGUIUtility.fieldWidth;

            rect.y += 2;
            GUI.Label(rect, "<b>TEXT INPUT BOX</b>" + (m_foldout.textInput ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label);
            if (GUI.Button(new Rect(rect.x, rect.y, rect.width - 150, rect.height), GUIContent.none, GUI.skin.label))
            {
                m_foldout.textInput = !m_foldout.textInput;
            }

            // Toggle showing Rich Tags
            GUI.Label(new Rect(rect.width - 125, rect.y + 4, 125, 24), "<i>Enable RTL Editor</i>", toggleStyle);
            isRightToLeft_prop.boolValue = EditorGUI.Toggle(new Rect(rect.width - 10, rect.y + 3, 20, 24), GUIContent.none, isRightToLeft_prop.boolValue);


            if (m_foldout.textInput)
            {
                EditorGUI.BeginChangeCheck();

                text_prop.stringValue = EditorGUILayout.TextArea(text_prop.stringValue, TMP_UIStyleManager.TextAreaBoxEditor, GUILayout.Height(125), GUILayout.ExpandWidth(true));

                if (EditorGUI.EndChangeCheck() || (isRightToLeft_prop.boolValue && (m_RTLText == null || m_RTLText == string.Empty)))
                {
                    inputSource_prop.enumValueIndex      = 0;
                    isInputPasingRequired_prop.boolValue = true;
                    havePropertiesChanged = true;

                    // Handle Left to Right or Right to Left Editor
                    if (isRightToLeft_prop.boolValue)
                    {
                        m_RTLText = string.Empty;
                        string sourceText = text_prop.stringValue;
                        // Reverse Text displayed in Text Input Box
                        for (int i = 0; i < sourceText.Length; i++)
                        {
                            m_RTLText += sourceText[sourceText.Length - i - 1];
                        }
                    }
                }

                if (isRightToLeft_prop.boolValue)
                {
                    EditorGUI.BeginChangeCheck();
                    m_RTLText = EditorGUILayout.TextArea(m_RTLText, TMP_UIStyleManager.TextAreaBoxEditor, GUILayout.Height(125), GUILayout.ExpandWidth(true));
                    if (EditorGUI.EndChangeCheck())
                    {
                        // Convert RTL input
                        string sourceText = string.Empty;
                        // Reverse Text displayed in Text Input Box
                        for (int i = 0; i < m_RTLText.Length; i++)
                        {
                            sourceText += m_RTLText[m_RTLText.Length - i - 1];
                        }

                        text_prop.stringValue = sourceText;
                    }
                }
            }

            // FONT SETTINGS SECTION
            if (GUILayout.Button("<b>FONT SETTINGS</b>" + (m_foldout.fontSettings ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
            {
                m_foldout.fontSettings = !m_foldout.fontSettings;
            }

            if (m_foldout.fontSettings)
            {
                // FONT ASSET
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(fontAsset_prop);
                if (EditorGUI.EndChangeCheck())
                {
                    Undo.RecordObject(m_renderer, "Asset & Material Change");
                    havePropertiesChanged = true;
                    hasFontAssetChanged_prop.boolValue = true;
                }


                // FONT STYLE
                EditorGUI.BeginChangeCheck();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Font Style");
                int styleValue = fontStyle_prop.intValue;

                int v1 = GUILayout.Toggle((styleValue & 1) == 1, "B", GUI.skin.button) ? 1 : 0;     // Bold
                int v2 = GUILayout.Toggle((styleValue & 2) == 2, "I", GUI.skin.button) ? 2 : 0;     // Italics
                int v3 = GUILayout.Toggle((styleValue & 4) == 4, "U", GUI.skin.button) ? 4 : 0;     // Underline
                int v7 = GUILayout.Toggle((styleValue & 64) == 64, "S", GUI.skin.button) ? 64 : 0;  // Strikethrough
                int v4 = GUILayout.Toggle((styleValue & 8) == 8, "ab", GUI.skin.button) ? 8 : 0;    // Lowercase
                int v5 = GUILayout.Toggle((styleValue & 16) == 16, "AB", GUI.skin.button) ? 16 : 0; // Uppercase
                int v6 = GUILayout.Toggle((styleValue & 32) == 32, "SC", GUI.skin.button) ? 32 : 0; // Smallcaps
                EditorGUILayout.EndHorizontal();

                if (EditorGUI.EndChangeCheck())
                {
                    fontStyle_prop.intValue = v1 + v2 + v3 + v4 + v5 + v6 + v7;
                    havePropertiesChanged   = true;
                }


                // FACE VERTEX COLOR
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(fontColor_prop, new GUIContent("Color (Vertex)"));

                // VERTEX COLOR GRADIENT
                EditorGUILayout.BeginHorizontal();
                //EditorGUILayout.PrefixLabel("Color Gradient");
                EditorGUILayout.PropertyField(enableVertexGradient_prop, new GUIContent("Color Gradient"), GUILayout.MinWidth(140), GUILayout.MaxWidth(200));
                EditorGUIUtility.labelWidth = 95;
                EditorGUILayout.PropertyField(overrideHtmlColor_prop, new GUIContent("Override Tags"));
                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUILayout.EndHorizontal();

                if (enableVertexGradient_prop.boolValue)
                {
                    EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("topLeft"), new GUIContent("Top Left"));
                    EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("topRight"), new GUIContent("Top Right"));
                    EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("bottomLeft"), new GUIContent("Bottom Left"));
                    EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("bottomRight"), new GUIContent("Bottom Right"));
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }


                // FONT SIZE
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(fontSize_prop, new GUIContent("Font Size"), GUILayout.MinWidth(168), GUILayout.MaxWidth(200));
                EditorGUIUtility.fieldWidth = fieldWidth;
                if (EditorGUI.EndChangeCheck())
                {
                    fontSizeBase_prop.floatValue = fontSize_prop.floatValue;
                    havePropertiesChanged        = true;
                    //isAffectingWordWrapping_prop.boolValue = true;
                }

                EditorGUI.BeginChangeCheck();
                EditorGUIUtility.labelWidth = 70;
                EditorGUILayout.PropertyField(autoSizing_prop, new GUIContent("Auto Size"));
                EditorGUILayout.EndHorizontal();

                EditorGUIUtility.labelWidth = labelWidth;
                if (EditorGUI.EndChangeCheck())
                {
                    if (autoSizing_prop.boolValue == false)
                    {
                        fontSize_prop.floatValue = fontSizeBase_prop.floatValue;
                    }

                    havePropertiesChanged = true;
                    //isAffectingWordWrapping_prop.boolValue = true;
                }


                // Show auto sizing options
                if (autoSizing_prop.boolValue)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Auto Size Options");
                    EditorGUIUtility.labelWidth = 24;

                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(fontSizeMin_prop, new GUIContent("Min"), GUILayout.MinWidth(46));
                    if (EditorGUI.EndChangeCheck())
                    {
                        fontSizeMin_prop.floatValue = Mathf.Min(fontSizeMin_prop.floatValue, fontSizeMax_prop.floatValue);
                        havePropertiesChanged       = true;
                    }

                    EditorGUIUtility.labelWidth = 27;
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(fontSizeMax_prop, new GUIContent("Max"), GUILayout.MinWidth(49));
                    if (EditorGUI.EndChangeCheck())
                    {
                        fontSizeMax_prop.floatValue = Mathf.Max(fontSizeMin_prop.floatValue, fontSizeMax_prop.floatValue);
                        havePropertiesChanged       = true;
                    }

                    EditorGUI.BeginChangeCheck();
                    EditorGUIUtility.labelWidth = 36;
                    //EditorGUILayout.PropertyField(charSpacingMax_prop, new GUIContent("Char"), GUILayout.MinWidth(50));
                    EditorGUILayout.PropertyField(charWidthMaxAdj_prop, new GUIContent("WD%"), GUILayout.MinWidth(58));
                    EditorGUIUtility.labelWidth = 28;
                    EditorGUILayout.PropertyField(lineSpacingMax_prop, new GUIContent("Line"), GUILayout.MinWidth(50));

                    EditorGUIUtility.labelWidth = labelWidth;
                    EditorGUILayout.EndHorizontal();

                    if (EditorGUI.EndChangeCheck())
                    {
                        charWidthMaxAdj_prop.floatValue = Mathf.Clamp(charWidthMaxAdj_prop.floatValue, 0, 50);
                        //charSpacingMax_prop.floatValue = Mathf.Min(0, charSpacingMax_prop.floatValue);
                        lineSpacingMax_prop.floatValue = Mathf.Min(0, lineSpacingMax_prop.floatValue);
                        havePropertiesChanged          = true;
                    }
                }

                // CHARACTER, LINE & PARAGRAPH SPACING
                EditorGUI.BeginChangeCheck();

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Spacing Options");
                EditorGUIUtility.labelWidth = 30;
                EditorGUILayout.PropertyField(characterSpacing_prop, new GUIContent("Char"), GUILayout.MinWidth(50));  //, GUILayout.MaxWidth(100));
                EditorGUILayout.PropertyField(lineSpacing_prop, new GUIContent("Line"), GUILayout.MinWidth(50));       //, GUILayout.MaxWidth(100));
                EditorGUILayout.PropertyField(paragraphSpacing_prop, new GUIContent(" Par."), GUILayout.MinWidth(50)); //, GUILayout.MaxWidth(100));

                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUILayout.EndHorizontal();

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    //isAffectingWordWrapping_prop.boolValue = true;
                }


                // TEXT ALIGNMENT
                EditorGUI.BeginChangeCheck();

                rect = EditorGUILayout.GetControlRect(false, 17);
                GUIStyle btn = new GUIStyle(GUI.skin.button);
                btn.margin  = new RectOffset(1, 1, 1, 1);
                btn.padding = new RectOffset(1, 1, 1, 0);

                selAlignGrid_A = textAlignment_prop.enumValueIndex & ~28;
                selAlignGrid_B = (textAlignment_prop.enumValueIndex & ~3) / 4;

                GUI.Label(new Rect(rect.x, rect.y, 100, rect.height), "Alignment");
                float columnB = EditorGUIUtility.labelWidth + 15;
                selAlignGrid_A = GUI.SelectionGrid(new Rect(columnB, rect.y, 23 * 4, rect.height), selAlignGrid_A, TMP_UIStyleManager.alignContent_A, 4, btn);
                selAlignGrid_B = GUI.SelectionGrid(new Rect(columnB + 23 * 4 + 10, rect.y, 23 * 5, rect.height), selAlignGrid_B, TMP_UIStyleManager.alignContent_B, 5, btn);

                if (EditorGUI.EndChangeCheck())
                {
                    textAlignment_prop.enumValueIndex = selAlignGrid_A + selAlignGrid_B * 4;
                    havePropertiesChanged             = true;
                }

                // WRAPPING RATIOS shown if Justified mode is selected.
                EditorGUI.BeginChangeCheck();
                if (textAlignment_prop.enumValueIndex == 3 || textAlignment_prop.enumValueIndex == 7 || textAlignment_prop.enumValueIndex == 11 || textAlignment_prop.enumValueIndex == 19)
                {
                    DrawPropertySlider("Wrap Mix (W <-> C)", wordWrappingRatios_prop);
                }

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }



                // TEXT WRAPPING & OVERFLOW
                EditorGUI.BeginChangeCheck();

                rect = EditorGUILayout.GetControlRect(false);
                EditorGUI.PrefixLabel(new Rect(rect.x, rect.y, 130, rect.height), new GUIContent("Wrapping & Overflow"));
                rect.width = (rect.width - 130) / 2f;
                rect.x    += 130;
                int wrapSelection = EditorGUI.Popup(rect, enableWordWrapping_prop.boolValue ? 1 : 0, new string[] { "Disabled", "Enabled" });
                if (EditorGUI.EndChangeCheck())
                {
                    enableWordWrapping_prop.boolValue    = wrapSelection == 1 ? true : false;
                    havePropertiesChanged                = true;
                    isInputPasingRequired_prop.boolValue = true;
                }


                // TEXT OVERFLOW
                EditorGUI.BeginChangeCheck();
                if (textOverflowMode_prop.enumValueIndex != 5)
                {
                    rect.x     += rect.width + 5f;
                    rect.width -= 5;
                    EditorGUI.PropertyField(rect, textOverflowMode_prop, GUIContent.none);
                }
                else
                {
                    rect.x     += rect.width + 5f;
                    rect.width /= 2;
                    EditorGUI.PropertyField(rect, textOverflowMode_prop, GUIContent.none);
                    rect.x     += rect.width;
                    rect.width -= 5;
                    EditorGUI.PropertyField(rect, pageToDisplay_prop, GUIContent.none);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    isInputPasingRequired_prop.boolValue = true;
                }


                // TEXTURE MAPPING OPTIONS
                EditorGUI.BeginChangeCheck();
                rect = EditorGUILayout.GetControlRect(false);
                EditorGUI.PrefixLabel(new Rect(rect.x, rect.y, 130, rect.height), new GUIContent("UV Mapping Options"));
                rect.width = (rect.width - 130) / 2f;
                rect.x    += 130;
                EditorGUI.PropertyField(rect, horizontalMapping_prop, GUIContent.none);
                rect.x     += rect.width + 5f;
                rect.width -= 5;
                EditorGUI.PropertyField(rect, verticalMapping_prop, GUIContent.none);
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }

                // UV OPTIONS
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("UV Offset");
                EditorGUILayout.PropertyField(uvOffset_prop, GUIContent.none, GUILayout.MinWidth(70f));
                EditorGUIUtility.labelWidth = 30;
                EditorGUILayout.PropertyField(uvLineOffset_prop, new GUIContent("Line"), GUILayout.MinWidth(70f));
                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUILayout.EndHorizontal();
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }


                // KERNING
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(enableKerning_prop, new GUIContent("Enable Kerning?"));
                if (EditorGUI.EndChangeCheck())
                {
                    //isAffectingWordWrapping_prop.boolValue = true;
                    havePropertiesChanged = true;
                }

                // EXTRA PADDING
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(enableExtraPadding_prop, new GUIContent("Extra Padding?"));
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    checkPaddingRequired_prop.boolValue = true;
                }
                EditorGUILayout.EndHorizontal();
            }



            if (GUILayout.Button("<b>EXTRA SETTINGS</b>" + (m_foldout.extraSettings ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
            {
                m_foldout.extraSettings = !m_foldout.extraSettings;
            }

            if (m_foldout.extraSettings)
            {
                EditorGUI.indentLevel = 0;

                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Sorting Layer");
                EditorGUI.BeginChangeCheck();

                float old_LabelWidth = EditorGUIUtility.labelWidth;
                float old_fieldWidth = EditorGUIUtility.fieldWidth;


                // SORTING LAYERS
                var sortingLayerNames = SortingLayerHelper.sortingLayerNames;

                // Look up the layer name using the current layer ID
                string oldName = SortingLayerHelper.GetSortingLayerNameFromID(m_textMeshProScript.sortingLayerID);

                // Use the name to look up our array index into the names list
                int oldLayerIndex = System.Array.IndexOf(sortingLayerNames, oldName);

                // Show the pop-up for the names
                EditorGUIUtility.fieldWidth = 0f;
                int newLayerIndex = EditorGUILayout.Popup(string.Empty, oldLayerIndex, sortingLayerNames, GUILayout.MinWidth(80f));

                // If the index changes, look up the ID for the new index to store as the new ID
                if (newLayerIndex != oldLayerIndex)
                {
                    //Undo.RecordObject(renderer, "Edit Sorting Layer");
                    m_textMeshProScript.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(newLayerIndex);
                    //EditorUtility.SetDirty(renderer);
                }

                // Expose the manual sorting order
                EditorGUIUtility.labelWidth = 40f;
                EditorGUIUtility.fieldWidth = 80f;
                int newSortingLayerOrder = EditorGUILayout.IntField("Order", m_textMeshProScript.sortingOrder);
                if (newSortingLayerOrder != m_textMeshProScript.sortingOrder)
                {
                    //Undo.RecordObject(renderer, "Edit Sorting Order");
                    m_textMeshProScript.sortingOrder = newSortingLayerOrder;
                }
                EditorGUILayout.EndHorizontal();
                EditorGUIUtility.labelWidth = old_LabelWidth;
                EditorGUIUtility.fieldWidth = old_fieldWidth;

                EditorGUI.BeginChangeCheck();
                //EditorGUILayout.PropertyField(isOverlay_prop, new GUIContent("Overlay Mode?"));
                EditorGUILayout.PropertyField(isOrthographic_prop, new GUIContent("Orthographic Mode?"));
                EditorGUILayout.PropertyField(isRichText_prop, new GUIContent("Enable Rich Text?"));
                //EditorGUILayout.PropertyField(textRectangle_prop, true);

                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }


                // EditorGUI.BeginChangeCheck();
                //EditorGUILayout.PropertyField(mask_prop);
                //EditorGUILayout.PropertyField(maskOffset_prop, true);
                //EditorGUILayout.PropertyField(maskSoftness_prop);
                //if (EditorGUI.EndChangeCheck())
                //{
                //    isMaskUpdateRequired_prop.boolValue = true;
                //    havePropertiesChanged = true;
                //}

                //EditorGUILayout.PropertyField(sortingLayerID_prop);
                //EditorGUILayout.PropertyField(sortingOrder_prop);

                // Mask Selection
            }

            /*
             * if (Event.current.type == EventType.DragExited)
             * {
             *  m_currentMaterialID = m_renderer.sharedMaterial.GetInstanceID();
             *  if (m_currentMaterialID != m_previousMaterialID)
             *  {
             *      Debug.Log("Material has been changed to " + m_currentMaterialID + ". Previous Material was " + m_previousMaterialID);
             *
             *      //m_targetMaterial = m_renderer.sharedMaterial;
             *      //TMPro_EventManager.ON_MATERIAL_PROPERTY_CHANGED(true, m_targetMaterial);
             *      m_previousMaterialID = m_currentMaterialID;
             *      havePropertiesChanged = true;
             *  }
             * }
             */

            if (havePropertiesChanged)
            {
                havePropertiesChanged_prop.boolValue = true;
                havePropertiesChanged = false;
                //m_updateManager.ScheduleObjectForUpdate(m_textMeshProScript);
            }

            EditorGUILayout.Space();

            serializedObject.ApplyModifiedProperties();


            /*
             * Editor materialEditor = Editor.CreateEditor(m_renderer.sharedMaterial);
             * if (materialEditor != null)
             * {
             *  if (GUILayout.Button("<b>MATERIAL SETTINGS</b>     - <i>Click to expand</i> -", Section_Label))
             *      m_foldout.materialEditor= !m_foldout.materialEditor;
             *
             *  if (m_foldout.materialEditor)
             *  {
             *      materialEditor.OnInspectorGUI();
             *  }
             * }
             */
        }
예제 #5
0
        public override void OnInspectorGUI()
        {
            EditorGUI.indentLevel = 0;

            // FONT SETTINGS SECTION
            if (GUILayout.Button("<b>SUB OBJECT SETTINGS</b>" + (m_foldout.fontSettings ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
            {
                m_foldout.fontSettings = !m_foldout.fontSettings;
            }

            if (m_foldout.fontSettings)
            {
                GUI.enabled = false;
                EditorGUILayout.PropertyField(fontAsset_prop);
                EditorGUILayout.PropertyField(spriteAsset_prop);
                GUI.enabled = true;
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Sorting Layer");
            EditorGUI.BeginChangeCheck();

            //float old_LabelWidth = EditorGUIUtility.labelWidth;
            //float old_fieldWidth = EditorGUIUtility.fieldWidth;


            // SORTING LAYERS
            var sortingLayerNames = SortingLayerHelper.sortingLayerNames;

            // Look up the layer name using the current layer ID
            string oldName = SortingLayerHelper.GetSortingLayerNameFromID(m_Renderer.sortingLayerID);

            // Use the name to look up our array index into the names list
            int oldLayerIndex = System.Array.IndexOf(sortingLayerNames, oldName);

            // Show the pop-up for the names
            EditorGUIUtility.fieldWidth = 0f;
            int newLayerIndex = EditorGUILayout.Popup(string.Empty, oldLayerIndex, sortingLayerNames, GUILayout.MinWidth(80f));

            // If the index changes, look up the ID for the new index to store as the new ID
            if (newLayerIndex != oldLayerIndex)
            {
                //Undo.RecordObject(renderer, "Edit Sorting Layer");
                m_Renderer.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(newLayerIndex);
                //EditorUtility.SetDirty(renderer);
            }

            // Expose the manual sorting order
            EditorGUIUtility.labelWidth = 40f;
            EditorGUIUtility.fieldWidth = 80f;
            int newSortingLayerOrder = EditorGUILayout.IntField("Order", m_Renderer.sortingOrder);

            if (newSortingLayerOrder != m_Renderer.sortingOrder)
            {
                //Undo.RecordObject(renderer, "Edit Sorting Order");
                m_Renderer.sortingOrder = newSortingLayerOrder;
            }
            EditorGUILayout.EndHorizontal();

            //    // If a Custom Material Editor exists, we use it.
            //    if (m_canvasRenderer != null && m_canvasRenderer.GetMaterial() != null)
            //    {
            //        Material mat = m_canvasRenderer.GetMaterial();

            //        //Debug.Log(mat + "  " + m_targetMaterial);

            //        if (mat != m_targetMaterial)
            //        {
            //            // Destroy previous Material Instance
            //            //Debug.Log("New Material has been assigned.");
            //            m_targetMaterial = mat;
            //            DestroyImmediate(m_materialEditor);
            //        }


            //        if (m_materialEditor == null)
            //        {
            //            m_materialEditor = Editor.CreateEditor(mat);
            //        }

            //        m_materialEditor.DrawHeader();


            //        m_materialEditor.OnInspectorGUI();
            //    }
        }
예제 #6
0
    public override void OnInspectorGUI()
    {
        // Get the renderer from the target object
        var renderer = (target as SortingLayerExposed).gameObject.GetComponent <Renderer>();

        // If there is no renderer, we can't do anything
        if (!renderer)
        {
            EditorGUILayout.HelpBox("SortingLayerExposed must be added to a game object that has a renderer.", MessageType.Error);
            return;
        }

        var sortingLayerNames = SortingLayerHelper.sortingLayerNames;

        // If we have the sorting layers array, we can make a nice dropdown. For stability's sake, if the array is null
        // we just use our old logic. This makes sure the script works in some fashion even if Unity changes the name of
        // that internal field we reflected.
        if (sortingLayerNames != null)
        {
            // Look up the layer name using the current layer ID
            string oldName = SortingLayerHelper.GetSortingLayerNameFromID(renderer.sortingLayerID);

            // Use the name to look up our array index into the names list
            int oldLayerIndex = Array.IndexOf(sortingLayerNames, oldName);

            // Show the popup for the names
            int newLayerIndex = EditorGUILayout.Popup("Sorting Layer", oldLayerIndex, sortingLayerNames);

            // If the index changes, look up the ID for the new index to store as the new ID
            if (newLayerIndex != oldLayerIndex)
            {
                Undo.RecordObject(renderer, "Edit Sorting Layer");
                renderer.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(newLayerIndex);
                EditorUtility.SetDirty(renderer);
            }
        }
        else
        {
            // Expose the sorting layer name
            string newSortingLayerName = EditorGUILayout.TextField("Sorting Layer Name", renderer.sortingLayerName);
            if (newSortingLayerName != renderer.sortingLayerName)
            {
                Undo.RecordObject(renderer, "Edit Sorting Layer Name");
                renderer.sortingLayerName = newSortingLayerName;
                EditorUtility.SetDirty(renderer);
            }

            // Expose the sorting layer ID
            int newSortingLayerId = EditorGUILayout.IntField("Sorting Layer ID", renderer.sortingLayerID);
            if (newSortingLayerId != renderer.sortingLayerID)
            {
                Undo.RecordObject(renderer, "Edit Sorting Layer ID");
                renderer.sortingLayerID = newSortingLayerId;
                EditorUtility.SetDirty(renderer);
            }
        }

        // Expose the manual sorting order
        int newSortingLayerOrder = EditorGUILayout.IntField("Sorting Layer Order", renderer.sortingOrder);

        if (newSortingLayerOrder != renderer.sortingOrder)
        {
            Undo.RecordObject(renderer, "Edit Sorting Order");
            renderer.sortingOrder = newSortingLayerOrder;
            EditorUtility.SetDirty(renderer);
        }
    }
예제 #7
0
        public override void OnInspectorGUI()
        {
            if (toggleStyle == null)
            {
                toggleStyle                  = new GUIStyle(GUI.skin.label);
                toggleStyle.fontSize         = 12;
                toggleStyle.normal.textColor = TMP_UIStyleManager.Section_Label.normal.textColor;
                toggleStyle.richText         = true;
            }
            base.serializedObject.Update();
            Rect  controlRect = EditorGUILayout.GetControlRect(false, 25f);
            float labelWidth  = EditorGUIUtility.labelWidth = 130f;
            float fieldWidth  = EditorGUIUtility.fieldWidth;

            controlRect.y += 2f;
            GUI.Label(controlRect, "<b>TEXT INPUT BOX</b>" + (m_foldout.textInput ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label);
            if (GUI.Button(new Rect(controlRect.x, controlRect.y, controlRect.width - 150f, controlRect.height), GUIContent.none, GUI.skin.label))
            {
                m_foldout.textInput = !m_foldout.textInput;
            }
            GUI.Label(new Rect(controlRect.width - 125f, controlRect.y + 4f, 125f, 24f), "<i>Enable RTL Editor</i>", toggleStyle);
            isRightToLeft_prop.boolValue = EditorGUI.Toggle(new Rect(controlRect.width - 10f, controlRect.y + 3f, 20f, 24f), GUIContent.none, isRightToLeft_prop.boolValue);
            if (m_foldout.textInput)
            {
                if (isLinkedTextComponent_prop.boolValue)
                {
                    EditorGUILayout.HelpBox("The Text Input Box is disabled due to this text component being linked to another.", MessageType.Info);
                }
                else
                {
                    EditorGUI.BeginChangeCheck();
                    text_prop.stringValue = EditorGUILayout.TextArea(text_prop.stringValue, TMP_UIStyleManager.TextAreaBoxEditor, GUILayout.Height(125f), GUILayout.ExpandWidth(true));
                    if (EditorGUI.EndChangeCheck() || (isRightToLeft_prop.boolValue && (m_RTLText == null || m_RTLText == string.Empty)))
                    {
                        inputSource_prop.enumValueIndex      = 0;
                        isInputPasingRequired_prop.boolValue = true;
                        havePropertiesChanged = true;
                        if (isRightToLeft_prop.boolValue)
                        {
                            m_RTLText = string.Empty;
                            string stringValue = text_prop.stringValue;
                            for (int i = 0; i < stringValue.Length; i++)
                            {
                                m_RTLText += stringValue[stringValue.Length - i - 1];
                            }
                        }
                    }
                    if (isRightToLeft_prop.boolValue)
                    {
                        EditorGUI.BeginChangeCheck();
                        m_RTLText = EditorGUILayout.TextArea(m_RTLText, TMP_UIStyleManager.TextAreaBoxEditor, GUILayout.Height(125f), GUILayout.ExpandWidth(true));
                        if (EditorGUI.EndChangeCheck())
                        {
                            string text = string.Empty;
                            for (int j = 0; j < m_RTLText.Length; j++)
                            {
                                text += m_RTLText[m_RTLText.Length - j - 1];
                            }
                            text_prop.stringValue = text;
                        }
                    }
                }
            }
            if (GUILayout.Button("<b>FONT SETTINGS</b>" + (m_foldout.fontSettings ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
            {
                m_foldout.fontSettings = !m_foldout.fontSettings;
            }
            if (m_isPresetListDirty)
            {
                m_materialPresetNames = GetMaterialPresets();
            }
            if (m_foldout.fontSettings)
            {
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(fontAsset_prop);
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    hasFontAssetChanged_prop.boolValue = true;
                    m_isPresetListDirty            = true;
                    m_materialPresetSelectionIndex = 0;
                }
                if (m_materialPresetNames != null)
                {
                    EditorGUI.BeginChangeCheck();
                    controlRect = EditorGUILayout.GetControlRect(false, 18f);
                    float fixedHeight = EditorStyles.popup.fixedHeight;
                    EditorStyles.popup.fixedHeight = controlRect.height;
                    int fontSize = EditorStyles.popup.fontSize;
                    EditorStyles.popup.fontSize    = 11;
                    m_materialPresetSelectionIndex = EditorGUI.Popup(controlRect, "Material Preset", m_materialPresetSelectionIndex, m_materialPresetNames);
                    if (EditorGUI.EndChangeCheck())
                    {
                        fontSharedMaterial_prop.objectReferenceValue = m_materialPresets[m_materialPresetSelectionIndex];
                        havePropertiesChanged = true;
                    }
                    if (m_materialPresetSelectionIndex < m_materialPresetNames.Length && m_targetMaterial != m_materialPresets[m_materialPresetSelectionIndex] && !havePropertiesChanged)
                    {
                        m_isPresetListDirty = true;
                    }
                    EditorStyles.popup.fixedHeight = fixedHeight;
                    EditorStyles.popup.fontSize    = fontSize;
                }
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Font Style");
                int intValue = fontStyle_prop.intValue;
                int num2     = GUILayout.Toggle((intValue & 1) == 1, "B", GUI.skin.button) ? 1 : 0;
                int num3     = GUILayout.Toggle((intValue & 2) == 2, "I", GUI.skin.button) ? 2 : 0;
                int num4     = GUILayout.Toggle((intValue & 4) == 4, "U", GUI.skin.button) ? 4 : 0;
                int num5     = GUILayout.Toggle((intValue & 0x40) == 64, "S", GUI.skin.button) ? 64 : 0;
                int num6     = GUILayout.Toggle((intValue & 8) == 8, "ab", GUI.skin.button) ? 8 : 0;
                int num7     = GUILayout.Toggle((intValue & 0x10) == 16, "AB", GUI.skin.button) ? 16 : 0;
                int num8     = GUILayout.Toggle((intValue & 0x20) == 32, "SC", GUI.skin.button) ? 32 : 0;
                EditorGUILayout.EndHorizontal();
                if (EditorGUI.EndChangeCheck())
                {
                    fontStyle_prop.intValue = num2 + num3 + num4 + num6 + num7 + num8 + num5;
                    havePropertiesChanged   = true;
                }
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(fontColor_prop, new GUIContent("Color (Vertex)"));
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(enableVertexGradient_prop, new GUIContent("Color Gradient"), GUILayout.MinWidth(140f), GUILayout.MaxWidth(200f));
                EditorGUIUtility.labelWidth = 95f;
                EditorGUILayout.PropertyField(overrideHtmlColor_prop, new GUIContent("Override Tags"));
                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUILayout.EndHorizontal();
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
                if (enableVertexGradient_prop.boolValue)
                {
                    EditorGUILayout.PropertyField(fontColorGradientPreset_prop, new GUIContent("Gradient (Preset)"));
                    if (fontColorGradientPreset_prop.objectReferenceValue == null)
                    {
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("topLeft"), new GUIContent("Top Left"));
                        EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("topRight"), new GUIContent("Top Right"));
                        EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("bottomLeft"), new GUIContent("Bottom Left"));
                        EditorGUILayout.PropertyField(fontColorGradient_prop.FindPropertyRelative("bottomRight"), new GUIContent("Bottom Right"));
                        if (EditorGUI.EndChangeCheck())
                        {
                            havePropertiesChanged = true;
                        }
                    }
                    else
                    {
                        SerializedObject serializedObject = new SerializedObject(fontColorGradientPreset_prop.objectReferenceValue);
                        EditorGUI.BeginChangeCheck();
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("topLeft"), new GUIContent("Top Left"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("topRight"), new GUIContent("Top Right"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("bottomLeft"), new GUIContent("Bottom Left"));
                        EditorGUILayout.PropertyField(serializedObject.FindProperty("bottomRight"), new GUIContent("Bottom Right"));
                        if (EditorGUI.EndChangeCheck())
                        {
                            serializedObject.ApplyModifiedProperties();
                            havePropertiesChanged = true;
                            TMPro_EventManager.ON_COLOR_GRAIDENT_PROPERTY_CHANGED(fontColorGradientPreset_prop.objectReferenceValue as TMP_ColorGradient);
                        }
                    }
                }
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(fontSize_prop, new GUIContent("Font Size"), GUILayout.MinWidth(168f), GUILayout.MaxWidth(200f));
                EditorGUIUtility.fieldWidth = fieldWidth;
                if (EditorGUI.EndChangeCheck())
                {
                    fontSizeBase_prop.floatValue = fontSize_prop.floatValue;
                    havePropertiesChanged        = true;
                }
                EditorGUI.BeginChangeCheck();
                EditorGUIUtility.labelWidth = 70f;
                EditorGUILayout.PropertyField(autoSizing_prop, new GUIContent("Auto Size"));
                EditorGUILayout.EndHorizontal();
                EditorGUIUtility.labelWidth = labelWidth;
                if (EditorGUI.EndChangeCheck())
                {
                    if (!autoSizing_prop.boolValue)
                    {
                        fontSize_prop.floatValue = fontSizeBase_prop.floatValue;
                    }
                    havePropertiesChanged = true;
                }
                if (autoSizing_prop.boolValue)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel("Auto Size Options");
                    EditorGUIUtility.labelWidth = 24f;
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(fontSizeMin_prop, new GUIContent("Min"), GUILayout.MinWidth(46f));
                    if (EditorGUI.EndChangeCheck())
                    {
                        fontSizeMin_prop.floatValue = Mathf.Min(fontSizeMin_prop.floatValue, fontSizeMax_prop.floatValue);
                        havePropertiesChanged       = true;
                    }
                    EditorGUIUtility.labelWidth = 27f;
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(fontSizeMax_prop, new GUIContent("Max"), GUILayout.MinWidth(49f));
                    if (EditorGUI.EndChangeCheck())
                    {
                        fontSizeMax_prop.floatValue = Mathf.Max(fontSizeMin_prop.floatValue, fontSizeMax_prop.floatValue);
                        havePropertiesChanged       = true;
                    }
                    EditorGUI.BeginChangeCheck();
                    EditorGUIUtility.labelWidth = 36f;
                    EditorGUILayout.PropertyField(charWidthMaxAdj_prop, new GUIContent("WD%"), GUILayout.MinWidth(58f));
                    EditorGUIUtility.labelWidth = 28f;
                    EditorGUILayout.PropertyField(lineSpacingMax_prop, new GUIContent("Line"), GUILayout.MinWidth(50f));
                    EditorGUIUtility.labelWidth = labelWidth;
                    EditorGUILayout.EndHorizontal();
                    if (EditorGUI.EndChangeCheck())
                    {
                        charWidthMaxAdj_prop.floatValue = Mathf.Clamp(charWidthMaxAdj_prop.floatValue, 0f, 50f);
                        lineSpacingMax_prop.floatValue  = Mathf.Min(0f, lineSpacingMax_prop.floatValue);
                        havePropertiesChanged           = true;
                    }
                }
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Spacing Options");
                EditorGUIUtility.labelWidth = 35f;
                EditorGUILayout.PropertyField(characterSpacing_prop, new GUIContent("Char"), GUILayout.MinWidth(50f));
                EditorGUILayout.PropertyField(wordSpacing_prop, new GUIContent("Word"), GUILayout.MinWidth(50f));
                EditorGUILayout.PropertyField(lineSpacing_prop, new GUIContent("Line"), GUILayout.MinWidth(50f));
                EditorGUILayout.PropertyField(paragraphSpacing_prop, new GUIContent(" Par."), GUILayout.MinWidth(50f));
                EditorGUIUtility.labelWidth = labelWidth;
                EditorGUILayout.EndHorizontal();
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
                EditorGUI.BeginChangeCheck();
                controlRect = EditorGUILayout.GetControlRect(false, 19f);
                GUIStyle gUIStyle = new GUIStyle(GUI.skin.button);
                gUIStyle.margin  = new RectOffset(1, 1, 1, 1);
                gUIStyle.padding = new RectOffset(1, 1, 1, 0);
                selAlignGrid_A   = TMP_EditorUtility.GetHorizontalAlignmentGridValue(textAlignment_prop.intValue);
                selAlignGrid_B   = TMP_EditorUtility.GetVerticalAlignmentGridValue(textAlignment_prop.intValue);
                GUI.Label(new Rect(controlRect.x, controlRect.y + 2f, 100f, controlRect.height), "Alignment");
                float num9 = EditorGUIUtility.labelWidth + 15f;
                selAlignGrid_A = GUI.SelectionGrid(new Rect(num9, controlRect.y, 138f, controlRect.height), selAlignGrid_A, TMP_UIStyleManager.alignContent_A, 6, gUIStyle);
                selAlignGrid_B = GUI.SelectionGrid(new Rect(num9 + 138f + 20f, controlRect.y, 138f, controlRect.height), selAlignGrid_B, TMP_UIStyleManager.alignContent_B, 6, gUIStyle);
                if (EditorGUI.EndChangeCheck())
                {
                    //int intValue2 = (1 << selAlignGrid_A) | (256 << selAlignGrid_B);
                    int intValue2 = selAlignGrid_A + (selAlignGrid_B * 4);
                    textAlignment_prop.intValue = intValue2;
                    havePropertiesChanged       = true;
                }
                EditorGUI.BeginChangeCheck();
                //if ((textAlignment_prop.intValue & 8) == 8 || (textAlignment_prop.intValue & 0x10) == 16)
                if (selAlignGrid_A == 3)
                {
                    DrawPropertySlider("Wrap Mix (W <-> C)", wordWrappingRatios_prop);
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
                EditorGUI.BeginChangeCheck();
                controlRect = EditorGUILayout.GetControlRect(false);
                EditorGUI.PrefixLabel(new Rect(controlRect.x, controlRect.y, 130f, controlRect.height), new GUIContent("Wrapping & Overflow"));
                controlRect.width = (controlRect.width - 130f) / 2f;
                controlRect.x    += 130f;
                int num10 = EditorGUI.Popup(controlRect, enableWordWrapping_prop.boolValue ? 1 : 0, new string[2]
                {
                    "Disabled",
                    "Enabled"
                });
                if (EditorGUI.EndChangeCheck())
                {
                    enableWordWrapping_prop.boolValue    = ((num10 == 1) ? true : false);
                    havePropertiesChanged                = true;
                    isInputPasingRequired_prop.boolValue = true;
                }
                EditorGUI.BeginChangeCheck();
                TMP_Text exists = linkedTextComponent_prop.objectReferenceValue as TMP_Text;
                if (textOverflowMode_prop.enumValueIndex == 6)
                {
                    controlRect.x     += controlRect.width + 5f;
                    controlRect.width /= 3f;
                    EditorGUI.PropertyField(controlRect, textOverflowMode_prop, GUIContent.none);
                    controlRect.x    += controlRect.width;
                    controlRect.width = controlRect.width * 2f - 5f;
                    EditorGUI.PropertyField(controlRect, linkedTextComponent_prop, GUIContent.none);
                    if (GUI.changed)
                    {
                        TMP_Text tMP_Text = linkedTextComponent_prop.objectReferenceValue as TMP_Text;
                        if ((bool)(UnityEngine.Object)(object) tMP_Text)
                        {
                            m_textComponent.linkedTextComponent = tMP_Text;
                        }
                    }
                }
                else if (textOverflowMode_prop.enumValueIndex == 5)
                {
                    controlRect.x     += controlRect.width + 5f;
                    controlRect.width /= 2f;
                    EditorGUI.PropertyField(controlRect, textOverflowMode_prop, GUIContent.none);
                    controlRect.x     += controlRect.width;
                    controlRect.width -= 5f;
                    EditorGUI.PropertyField(controlRect, pageToDisplay_prop, GUIContent.none);
                    if ((bool)(UnityEngine.Object)(object) exists)
                    {
                        m_textComponent.linkedTextComponent = null;
                    }
                }
                else
                {
                    controlRect.x     += controlRect.width + 5f;
                    controlRect.width -= 5f;
                    EditorGUI.PropertyField(controlRect, textOverflowMode_prop, GUIContent.none);
                    if ((bool)(UnityEngine.Object)(object) exists)
                    {
                        m_textComponent.linkedTextComponent = null;
                    }
                }
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    isInputPasingRequired_prop.boolValue = true;
                }
                EditorGUI.BeginChangeCheck();
                controlRect = EditorGUILayout.GetControlRect(false);
                EditorGUI.PrefixLabel(new Rect(controlRect.x, controlRect.y, 130f, controlRect.height), new GUIContent("UV Mapping Options"));
                controlRect.width = (controlRect.width - 130f) / 2f;
                controlRect.x    += 130f;
                EditorGUI.PropertyField(controlRect, horizontalMapping_prop, GUIContent.none);
                controlRect.x     += controlRect.width + 5f;
                controlRect.width -= 5f;
                EditorGUI.PropertyField(controlRect, verticalMapping_prop, GUIContent.none);
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
                if (horizontalMapping_prop.enumValueIndex > 0)
                {
                    EditorGUI.BeginChangeCheck();
                    EditorGUILayout.PropertyField(uvLineOffset_prop, new GUIContent("UV Line Offset"), GUILayout.MinWidth(70f));
                    if (EditorGUI.EndChangeCheck())
                    {
                        havePropertiesChanged = true;
                    }
                }
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(enableKerning_prop, new GUIContent("Enable Kerning?"));
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(enableExtraPadding_prop, new GUIContent("Extra Padding?"));
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    checkPaddingRequired_prop.boolValue = true;
                }
                EditorGUILayout.EndHorizontal();
            }
            if (GUILayout.Button("<b>EXTRA SETTINGS</b>" + (m_foldout.extraSettings ? uiStateLabel[1] : uiStateLabel[0]), TMP_UIStyleManager.Section_Label))
            {
                m_foldout.extraSettings = !m_foldout.extraSettings;
            }
            if (m_foldout.extraSettings)
            {
                EditorGUI.indentLevel = 0;
                EditorGUI.BeginChangeCheck();
                DrawMaginProperty(margin_prop, "Margins");
                if (EditorGUI.EndChangeCheck())
                {
                    m_textComponent.margin = margin_prop.vector4Value;
                    havePropertiesChanged  = true;
                }
                GUILayout.Space(10f);
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PrefixLabel("Sorting Layer");
                EditorGUI.BeginChangeCheck();
                float    labelWidth2            = EditorGUIUtility.labelWidth;
                float    fieldWidth2            = EditorGUIUtility.fieldWidth;
                string[] sortingLayerNames      = SortingLayerHelper.sortingLayerNames;
                string   sortingLayerNameFromID = SortingLayerHelper.GetSortingLayerNameFromID(m_textComponent.sortingLayerID);
                int      num11 = Array.IndexOf(sortingLayerNames, sortingLayerNameFromID);
                EditorGUIUtility.fieldWidth = 0f;
                int num12 = EditorGUILayout.Popup(string.Empty, num11, sortingLayerNames, GUILayout.MinWidth(80f));
                if (num12 != num11)
                {
                    m_textComponent.sortingLayerID = SortingLayerHelper.GetSortingLayerIDForIndex(num12);
                }
                EditorGUIUtility.labelWidth = 40f;
                EditorGUIUtility.fieldWidth = 80f;
                int num13 = EditorGUILayout.IntField("Order", m_textComponent.sortingOrder);
                if (num13 != m_textComponent.sortingOrder)
                {
                    m_textComponent.sortingOrder = num13;
                }
                EditorGUILayout.EndHorizontal();
                EditorGUIUtility.labelWidth = labelWidth2;
                EditorGUIUtility.fieldWidth = fieldWidth2;
                EditorGUILayout.PropertyField(geometrySortingOrder_prop, new GUIContent("Geometry Sorting"));
                EditorGUI.BeginChangeCheck();
                EditorGUIUtility.labelWidth = 150f;
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(isOrthographic_prop, new GUIContent("Orthographic Mode?"));
                EditorGUILayout.PropertyField(isRichText_prop, new GUIContent("Enable Rich Text?"));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.PropertyField(enableEscapeCharacterParsing_prop, new GUIContent("Parse Escape Characters"));
                EditorGUILayout.PropertyField(useMaxVisibleDescender_prop, new GUIContent("Use Visible Descender"));
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.PropertyField(spriteAsset_prop, new GUIContent("Sprite Asset", "The Sprite Asset used when NOT specifically referencing one using <sprite=\"Sprite Asset Name\"."), true);
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                }
                EditorGUI.BeginChangeCheck();
                EditorGUILayout.PropertyField(isVolumetricText_prop, new GUIContent("Enabled Volumetric Setup"));
                if (EditorGUI.EndChangeCheck())
                {
                    havePropertiesChanged = true;
                    m_textComponent.textInfo.ResetVertexLayout(isVolumetricText_prop.boolValue);
                }
                EditorGUIUtility.labelWidth = 135f;
                GUILayout.Space(10f);
            }
            if (havePropertiesChanged)
            {
                havePropertiesChanged_prop.boolValue = true;
                havePropertiesChanged = false;
            }
            EditorGUILayout.Space();
            base.serializedObject.ApplyModifiedProperties();
        }