コード例 #1
0
        void OnEnable()
        {
            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            // Get all serialized properties
            prop_isEnabled         = serializedObject.FindProperty("m_isEnabled");
            prop_propertiesChanged = serializedObject.FindProperty("propertiesChanged");

            // Get the appropriate skin based on Dark or Light Unity Skin.
            if (EditorGUIUtility.isProSkin)
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }
            else
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }

            if (mySkin != null)
            {
                fieldLabel = mySkin.FindStyle("Section Label");
                //textAreaBox = mySkin.FindStyle("Text Area Box (Editor)");
            }
        }
コード例 #2
0
        public void OnEnable()
        {
            m_editorWindow = this;
            UpdateEditorWindowSize(768, 768);


            // Get the UI Skin and Styles for the various Editors
            TMP_UIStyleManager.GetUIStyles();


            // Locate the plugin files & move them to root of project if that hasn't already been done.
#if !UNITY_5
            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            string projectPath = Path.GetFullPath("Assets/..");

            if (System.IO.File.Exists(projectPath + "/TMPro_Plugin.dll") == false)
            {
                FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/TMPro_Plugin.dll", projectPath + "/TMPro_Plugin.dll");     // Copy the .dll
                FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/TMPro_Plugin.dylib", projectPath + "/TMPro_Plugin.dylib"); // Copy Mac .dylib
                FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/vcomp120.dll", projectPath + "/vcomp120.dll");             // Copy OpemMP .dll
            }
            else // Check if we are using the latest versions
            {
                if (System.IO.File.GetLastWriteTime(tmproAssetFolderPath + "/Plugins/TMPro_Plugin.dylib") > System.IO.File.GetLastWriteTime(projectPath + "/TMPro_Plugin.dylib"))
                {
                    FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/TMPro_Plugin.dylib", projectPath + "/TMPro_Plugin.dylib");
                }

                if (System.IO.File.GetLastWriteTime(tmproAssetFolderPath + "/Plugins/TMPro_Plugin.dll") > System.IO.File.GetLastWriteTime(projectPath + "/TMPro_Plugin.dll"))
                {
                    FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/TMPro_Plugin.dll", projectPath + "/TMPro_Plugin.dll");
                }

                if (System.IO.File.GetLastWriteTime(tmproAssetFolderPath + "/Plugins/vcomp120.dll") > System.IO.File.GetLastWriteTime(projectPath + "/vcomp120.dll"))
                {
                    FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/vcomp120.dll", projectPath + "/vcomp120.dll");
                }
            }
#endif

            // Add Event Listener related to Distance Field Atlas Creation.
            TMPro_EventManager.COMPUTE_DT_EVENT += ON_COMPUTE_DT_EVENT;

            // Debug Link to received message from Native Code
            //TMPro_FontPlugin.LinkDebugLog(); // Link with C++ Plugin to get Debug output
        }
コード例 #3
0
        public void OnEnable()
        {
            m_editorWindow = this;
            UpdateEditorWindowSize(768, 768);

            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            if (EditorGUIUtility.isProSkin)
            {
                mySkin          = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
                progressTexture = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/Progress Bar.psd", typeof(Texture2D)) as Texture2D;
            }
            else
            {
                mySkin          = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;
                progressTexture = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/Progress Bar (Light).psd", typeof(Texture2D)) as Texture2D;
            }

            if (mySkin != null)
            {
                SectionLabel   = mySkin.FindStyle("Section Label");
                textureAreaBox = mySkin.FindStyle("Texture Area Box");
                textAreaBox    = mySkin.FindStyle("Text Area Box (Window)");
            }

            // Locate the plugin files & move them to root of project if that hasn't already been done.
            string projectPath = Path.GetFullPath("Assets/..");


            if (System.IO.File.Exists(projectPath + "/TMPro_Plugin.dll") == false)
            {
                FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/TMPro_Plugin.dll", projectPath + "/TMPro_Plugin.dll");     // Copy the .dll
                FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/TMPro_Plugin.dylib", projectPath + "/TMPro_Plugin.dylib"); // Copy Mac .dylib
                FileUtil.ReplaceFile(tmproAssetFolderPath + "/Plugins/vcomp120.dll", projectPath + "/vcomp120.dll");             // Copy OpemMP .dll
            }

            // Add Event Listener related to Distance Field Atlas Creation.
            TMPro_EventManager.COMPUTE_DT_EVENT += ON_COMPUTE_DT_EVENT;

            // Debug Link to received message from Native Code
            //TMPro_FontPlugin.LinkDebugLog(); // Link with C++ Plugin to get Debug output
        }
コード例 #4
0
        void OnEnable()
        {
            // Serialized Properties
            anchorPosition_prop = serializedObject.FindProperty("m_anchorPosition");
            pivot_prop          = serializedObject.FindProperty("m_pivot");
            rectangle_prop      = serializedObject.FindProperty("m_rect");
            margins_prop        = serializedObject.FindProperty("m_margins");

            m_textContainer = (TextContainer)target;
            m_transform     = Selection.activeGameObject.transform;


            // GUI SKINS
            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            // GUI Skin
            if (EditorGUIUtility.isProSkin)
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }
            else
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }

            if (mySkin != null)
            {
                SectionLabel = mySkin.FindStyle("Section Label");
                //GroupLabel = mySkin.FindStyle("Group Label");
                //SquareAreaBox85G = mySkin.FindStyle("Square Area Box (85 Grey)");
            }

            /*
             * if (m_visualHelper == null)
             * {
             *  m_visualHelper = GameObject.CreatePrimitive(PrimitiveType.Sphere).transform;
             *  m_visualHelper.localScale = new Vector3(0.25f, 0.25f, 0.25f);
             * }
             */
        }
コード例 #5
0
ファイル: TMPro_FontEditor.cs プロジェクト: wangyankai/myLib
        public void OnEnable()
        {
            font_atlas_prop       = serializedObject.FindProperty("atlas");
            font_material_prop    = serializedObject.FindProperty("material");
            font_normalStyle_prop = serializedObject.FindProperty("NormalStyle");
            font_boldStyle_prop   = serializedObject.FindProperty("BoldStyle");
            font_italicStyle_prop = serializedObject.FindProperty("ItalicStyle");

            m_fontInfo_prop      = serializedObject.FindProperty("m_fontInfo");
            m_glyphInfoList_prop = serializedObject.FindProperty("m_glyphInfoList");
            m_kerningInfo_prop   = serializedObject.FindProperty("m_kerningInfo");
            m_kerningPair_prop   = serializedObject.FindProperty("m_kerningPair");

            //m_isGlyphInfoListExpanded_prop = serializedObject.FindProperty("isGlyphInfoListExpanded");
            //m_isKerningTableExpanded_prop = serializedObject.FindProperty("isKerningTableExpanded");

            m_fontAsset    = target as TextMeshProFont;
            m_kerningTable = m_fontAsset.kerningInfo;

            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            // GUI Skin
            if (EditorGUIUtility.isProSkin)
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }
            else
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }

            if (mySkin != null)
            {
                SectionLabel     = mySkin.FindStyle("Section Label");
                GroupLabel       = mySkin.FindStyle("Group Label");
                SquareAreaBox85G = mySkin.FindStyle("Square Area Box (85 Grey)");
            }
        }
コード例 #6
0
        public static void GetUIStyles()
        {
            if (TMP_GUISkin != null)
            {
                return;
            }

            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            if (EditorGUIUtility.isProSkin)
            {
                TMP_GUISkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;

                alignLeft      = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignLeft.psd", typeof(Texture2D)) as Texture2D;
                alignCenter    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignCenter.psd", typeof(Texture2D)) as Texture2D;
                alignRight     = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignRight.psd", typeof(Texture2D)) as Texture2D;
                alignJustified = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignJustified.psd", typeof(Texture2D)) as Texture2D;
                alignTop       = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignTop.psd", typeof(Texture2D)) as Texture2D;
                alignMiddle    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignMiddle.psd", typeof(Texture2D)) as Texture2D;
                alignBottom    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignBottom.psd", typeof(Texture2D)) as Texture2D;
                alignBaseline  = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignBaseLine.psd", typeof(Texture2D)) as Texture2D;
                alignMidline   = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignMidLine.psd", typeof(Texture2D)) as Texture2D;

                progressTexture = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/Progress Bar.psd", typeof(Texture2D)) as Texture2D;
            }
            else
            {
                TMP_GUISkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;

                alignLeft      = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignLeft_Light.psd", typeof(Texture2D)) as Texture2D;
                alignCenter    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignCenter_Light.psd", typeof(Texture2D)) as Texture2D;
                alignRight     = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignRight_Light.psd", typeof(Texture2D)) as Texture2D;
                alignJustified = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignJustified_Light.psd", typeof(Texture2D)) as Texture2D;
                alignTop       = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignTop_Light.psd", typeof(Texture2D)) as Texture2D;
                alignMiddle    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignMiddle_Light.psd", typeof(Texture2D)) as Texture2D;
                alignBottom    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignBottom_Light.psd", typeof(Texture2D)) as Texture2D;
                alignBaseline  = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignBaseLine_Light.psd", typeof(Texture2D)) as Texture2D;
                alignMidline   = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignMidLine_Light.psd", typeof(Texture2D)) as Texture2D;

                progressTexture = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/Progress Bar (Light).psd", typeof(Texture2D)) as Texture2D;
            }

            if (TMP_GUISkin != null)
            {
                Label             = TMP_GUISkin.FindStyle("Label");
                Section_Label     = TMP_GUISkin.FindStyle("Section Label");
                Group_Label       = TMP_GUISkin.FindStyle("Group Label");
                Group_Label_Left  = TMP_GUISkin.FindStyle("Group Label - Left Half");
                TextAreaBoxEditor = TMP_GUISkin.FindStyle("Text Area Box (Editor)");
                TextAreaBoxWindow = TMP_GUISkin.FindStyle("Text Area Box (Window)");
                TextureAreaBox    = TMP_GUISkin.FindStyle("Texture Area Box");
                SquareAreaBox85G  = TMP_GUISkin.FindStyle("Square Area Box (85 Grey)");



                alignContent_A = new GUIContent[] {
                    new GUIContent(alignLeft, "Left"),
                    new GUIContent(alignCenter, "Center"),
                    new GUIContent(alignRight, "Right"),
                    new GUIContent(alignJustified, "Justified")
                };

                alignContent_B = new GUIContent[] {
                    new GUIContent(alignTop, "Top"),
                    new GUIContent(alignMiddle, "Middle"),
                    new GUIContent(alignBottom, "Bottom"),
                    new GUIContent(alignBaseline, "Baseline"),
                    new GUIContent(alignMidline, "Midline")
                };
            }

            //m_isInitialized = true;
        }
コード例 #7
0
        public void OnEnable()
        {
            //Debug.Log("New Instance of TMPRO UGUI Editor with ID " + this.GetInstanceID());

            // Initialize the Event Listener for Undo Events.
            Undo.undoRedoPerformed += OnUndoRedo;
            //Undo.postprocessModifications += OnUndoRedoEvent;

            text_prop               = serializedObject.FindProperty("m_text");
            fontAsset_prop          = serializedObject.FindProperty("m_fontAsset");
            fontSharedMaterial_prop = serializedObject.FindProperty("m_sharedMaterial");
            //fontBaseMaterial_prop = serializedObject.FindProperty("m_baseMaterial");
            isNewBaseMaterial_prop = serializedObject.FindProperty("m_isNewBaseMaterial");

            fontStyle_prop = serializedObject.FindProperty("m_fontStyle");

            fontSize_prop     = serializedObject.FindProperty("m_fontSize");
            fontSizeBase_prop = serializedObject.FindProperty("m_fontSizeBase");

            autoSizing_prop     = serializedObject.FindProperty("m_enableAutoSizing");
            fontSizeMin_prop    = serializedObject.FindProperty("m_fontSizeMin");
            fontSizeMax_prop    = serializedObject.FindProperty("m_fontSizeMax");
            charSpacingMax_prop = serializedObject.FindProperty("m_charSpacingMax");
            lineSpacingMax_prop = serializedObject.FindProperty("m_lineSpacingMax");

            // Colors & Gradient
            fontColor_prop            = serializedObject.FindProperty("m_fontColor");
            enableVertexGradient_prop = serializedObject.FindProperty("m_enableVertexGradient");
            fontColorGradient_prop    = serializedObject.FindProperty("m_fontColorGradient");
            overrideHtmlColor_prop    = serializedObject.FindProperty("m_overrideHtmlColors");

            characterSpacing_prop = serializedObject.FindProperty("m_characterSpacing");
            lineSpacing_prop      = serializedObject.FindProperty("m_lineSpacing");
            paragraphSpacing_prop = serializedObject.FindProperty("m_paragraphSpacing");

            textAlignment_prop = serializedObject.FindProperty("m_textAlignment");

            enableWordWrapping_prop = serializedObject.FindProperty("m_enableWordWrapping");
            wordWrappingRatios_prop = serializedObject.FindProperty("m_wordWrappingRatios");
            textOverflowMode_prop   = serializedObject.FindProperty("m_overflowMode");

            horizontalMapping_prop = serializedObject.FindProperty("m_horizontalMapping");
            verticalMapping_prop   = serializedObject.FindProperty("m_verticalMapping");
            uvOffset_prop          = serializedObject.FindProperty("m_uvOffset");
            uvLineOffset_prop      = serializedObject.FindProperty("m_uvLineOffset");

            enableKerning_prop = serializedObject.FindProperty("m_enableKerning");


            //isOrthographic_prop = serializedObject.FindProperty("m_isOrthographic");

            havePropertiesChanged_prop = serializedObject.FindProperty("havePropertiesChanged");
            inputSource_prop           = serializedObject.FindProperty("m_inputSource");
            isInputPasingRequired_prop = serializedObject.FindProperty("isInputParsingRequired");
            //isAffectingWordWrapping_prop = serializedObject.FindProperty("isAffectingWordWrapping");
            enableExtraPadding_prop   = serializedObject.FindProperty("m_enableExtraPadding");
            isRichText_prop           = serializedObject.FindProperty("m_isRichText");
            checkPaddingRequired_prop = serializedObject.FindProperty("checkPaddingRequired");


            margin_prop = serializedObject.FindProperty("m_margin");

            //isMaskUpdateRequired_prop = serializedObject.FindProperty("isMaskUpdateRequired");
            //mask_prop = serializedObject.FindProperty("m_mask");
            maskOffset_prop = serializedObject.FindProperty("m_maskOffset");
            //maskOffsetMode_prop = serializedObject.FindProperty("m_maskOffsetMode");
            //maskSoftness_prop = serializedObject.FindProperty("m_maskSoftness");
            //vertexOffset_prop = serializedObject.FindProperty("m_vertexOffset");

            //sortingLayerID_prop = serializedObject.FindProperty("m_sortingLayerID");
            //sortingOrder_prop = serializedObject.FindProperty("m_sortingOrder");

            hasFontAssetChanged_prop = serializedObject.FindProperty("hasFontAssetChanged");

            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            if (EditorGUIUtility.isProSkin)
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;

                alignLeft      = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignLeft.psd", typeof(Texture2D)) as Texture2D;
                alignCenter    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignCenter.psd", typeof(Texture2D)) as Texture2D;
                alignRight     = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignRight.psd", typeof(Texture2D)) as Texture2D;
                alignJustified = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignJustified.psd", typeof(Texture2D)) as Texture2D;
                alignTop       = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignTop.psd", typeof(Texture2D)) as Texture2D;
                alignMiddle    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignMiddle.psd", typeof(Texture2D)) as Texture2D;
                alignBottom    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignBottom.psd", typeof(Texture2D)) as Texture2D;
            }
            else
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;

                alignLeft      = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignLeft_Light.psd", typeof(Texture2D)) as Texture2D;
                alignCenter    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignCenter_Light.psd", typeof(Texture2D)) as Texture2D;
                alignRight     = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignRight_Light.psd", typeof(Texture2D)) as Texture2D;
                alignJustified = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignJustified_Light.psd", typeof(Texture2D)) as Texture2D;
                alignTop       = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignTop_Light.psd", typeof(Texture2D)) as Texture2D;
                alignMiddle    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignMiddle_Light.psd", typeof(Texture2D)) as Texture2D;
                alignBottom    = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/Textures/btn_AlignBottom_Light.psd", typeof(Texture2D)) as Texture2D;
            }

            if (mySkin != null)
            {
                Section_Label = mySkin.FindStyle("Section Label");
                //Group_Label = mySkin.FindStyle("Group Label");
                textAreaBox = mySkin.FindStyle("Text Area Box (Editor)");

                alignContent_A = new GUIContent[] {
                    new GUIContent(alignLeft, "Left"),
                    new GUIContent(alignCenter, "Center"),
                    new GUIContent(alignRight, "Right"),
                    new GUIContent(alignJustified, "Justified")
                };

                alignContent_B = new GUIContent[] {
                    new GUIContent(alignTop, "Top"),
                    new GUIContent(alignMiddle, "Middle"),
                    new GUIContent(alignBottom, "Bottom")
                };
            }

            m_textMeshProScript = (TextMeshProUGUI)target;
            m_rectTransform     = Selection.activeGameObject.GetComponent <RectTransform>();
            m_uiRenderer        = Selection.activeGameObject.GetComponent <CanvasRenderer>();

            // Add a Material Component if one does not exists

            /*
             * m_materialComponent = Selection.activeGameObject.GetComponent<MaterialComponent> ();
             *          if (m_materialComponent == null)
             *          {
             *                  m_materialComponent = Selection.activeGameObject.AddComponent<MaterialComponent> ();
             *          }
             */


            // Create new Material Editor if one does not exists
            if (m_uiRenderer != null && m_uiRenderer.GetMaterial() != null)
            {
                m_materialEditor = Editor.CreateEditor(m_uiRenderer.GetMaterial());
                m_targetMaterial = m_uiRenderer.GetMaterial();
                //Debug.Log("Currently Assigned Material is " + m_targetMaterial + ".  Font Material is " + m_textMeshProScript.fontSharedMaterial);
            }

            //m_updateManager = Camera.main.gameObject.GetComponent<TMPro_UpdateManager>();
        }
コード例 #8
0
        public void OnEnable()
        {
            // Initialize the Event Listener for Undo Events.
            Undo.undoRedoPerformed += OnUndoRedo;
            //Undo.postprocessModifications += OnUndoRedoEvent;

            text_prop      = serializedObject.FindProperty("m_text");
            fontAsset_prop = serializedObject.FindProperty("m_fontAsset");

            fontSize_prop         = serializedObject.FindProperty("m_fontSize");
            fontColor_prop        = serializedObject.FindProperty("m_fontColor");
            characterSpacing_prop = serializedObject.FindProperty("m_characterSpacing");
            lineLength_prop       = serializedObject.FindProperty("m_lineLength");
            //textRectangle_prop = serializedObject.FindProperty("m_textRectangle");
            lineSpacing_prop        = serializedObject.FindProperty("m_lineSpacing");
            lineJustification_prop  = serializedObject.FindProperty("m_lineJustification");
            anchorPosition_prop     = serializedObject.FindProperty("m_anchor");
            horizontalMapping_prop  = serializedObject.FindProperty("m_horizontalMapping");
            verticalMapping_prop    = serializedObject.FindProperty("m_verticalMapping");
            enableKerning_prop      = serializedObject.FindProperty("m_enableKerning");
            overrideHtmlColor_prop  = serializedObject.FindProperty("m_overrideHtmlColors");
            enableWordWrapping_prop = serializedObject.FindProperty("m_enableWordWrapping");
            wordWrappingRatios_prop = serializedObject.FindProperty("m_wordWrappingRatios");

            isOrthographic_prop = serializedObject.FindProperty("m_isOrthographic");

            havePropertiesChanged_prop   = serializedObject.FindProperty("havePropertiesChanged");
            inputSource_prop             = serializedObject.FindProperty("m_inputSource");
            isInputPasingRequired_prop   = serializedObject.FindProperty("isInputParsingRequired");
            isAffectingWordWrapping_prop = serializedObject.FindProperty("isAffectingWordWrapping");
            enableExtraPadding_prop      = serializedObject.FindProperty("m_enableExtraPadding");
            isRichText_prop           = serializedObject.FindProperty("m_isRichText");
            checkPaddingRequired_prop = serializedObject.FindProperty("checkPaddingRequired");

            //isMaskUpdateRequired_prop = serializedObject.FindProperty("isMaskUpdateRequired");
            //mask_prop = serializedObject.FindProperty("m_mask");
            //maskOffset_prop= serializedObject.FindProperty("m_maskOffset");
            //maskOffsetMode_prop = serializedObject.FindProperty("m_maskOffsetMode");
            //maskSoftness_prop = serializedObject.FindProperty("m_maskSoftness");
            //vertexOffset_prop = serializedObject.FindProperty("m_vertexOffset");

            sortingLayerID_prop = serializedObject.FindProperty("m_sortingLayerID");
            sortingOrder_prop   = serializedObject.FindProperty("m_sortingOrder");

            hasFontAssetChanged_prop = serializedObject.FindProperty("hasFontAssetChanged");

            // Find to location of the TextMesh Pro Asset Folder (as users may have moved it)
            string tmproAssetFolderPath = TMPro_EditorUtility.GetAssetLocation();

            if (EditorGUIUtility.isProSkin)
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_DarkSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }
            else
            {
                mySkin = AssetDatabase.LoadAssetAtPath(tmproAssetFolderPath + "/GUISkins/TMPro_LightSkin.guiskin", typeof(GUISkin)) as GUISkin;
            }

            if (mySkin != null)
            {
                Section_Label = mySkin.FindStyle("Section Label");
                //Group_Label = mySkin.FindStyle("Group Label");
                textAreaBox = mySkin.FindStyle("Text Area Box (Editor)");
            }

            m_textMeshProScript = (TextMeshPro)target;
            m_transform         = Selection.activeGameObject.transform;
            m_renderer          = Selection.activeGameObject.renderer;

            //m_updateManager = Camera.main.gameObject.GetComponent<TMPro_UpdateManager>();
        }