Exemplo n.º 1
0
        private void CreateTextMeshProComponent()
        {
            //IL_0047: Unknown result type (might be due to invalid IL or missing references)
            //IL_0053: Unknown result type (might be due to invalid IL or missing references)
            TextMeshProUGUICustom textMeshProUGUICustom = this.GetComponent <TextMeshProUGUICustom>();

            if (null == textMeshProUGUICustom)
            {
                textMeshProUGUICustom = this.get_gameObject().AddComponent <TextMeshProUGUICustom>();
            }
            else
            {
                textMeshProUGUICustom.set_enabled(true);
            }
            m_textMeshProComponent = textMeshProUGUICustom;
            ApplyFontCollection();
            textMeshProUGUICustom.set_fontStyle((int)m_fontStyle | (int)m_textStyle);
            textMeshProUGUICustom.set_alignment(m_textAlignment);
            textMeshProUGUICustom.set_color(m_color);
            textMeshProUGUICustom.set_wordWrappingRatios(m_textAlignmentWrapMix);
            textMeshProUGUICustom.set_enableWordWrapping(m_enableWordWrapping);
            textMeshProUGUICustom.set_overflowMode(m_overflowMode);
            textMeshProUGUICustom.set_richText(m_richText);
            textMeshProUGUICustom.set_enableKerning(true);
            textMeshProUGUICustom.set_extraPadding(true);
            textMeshProUGUICustom.set_raycastTarget(false);
            if (m_textDirty)
            {
                textMeshProUGUICustom.set_text(GetFormattedText());
                m_textDirty = false;
            }
            this.TextComponentCreated?.Invoke(textMeshProUGUICustom);
        }
Exemplo n.º 2
0
        private void ApplyFontCollection()
        {
            TextMeshProUGUICustom textMeshProComponent = m_textMeshProComponent;

            if (null == m_fontCollection)
            {
                textMeshProComponent.set_font(TMP_FontAsset.get_defaultFontAsset());
                return;
            }
            textMeshProComponent.set_font(m_fontCollection.fontAsset);
            Material styleMaterial = m_fontCollection.styleMaterial;

            if (null != styleMaterial)
            {
                textMeshProComponent.set_fontSharedMaterial(m_fontCollection.styleMaterial);
            }
            else
            {
                textMeshProComponent.set_fontSharedMaterial(textMeshProComponent.get_font().material);
            }
            FontData fontData = m_fontCollection.fontData;

            if (fontData != null)
            {
                textMeshProComponent.set_fontSize(fontData.fontSize);
                textMeshProComponent.set_characterSpacing(fontData.characterSpacing);
                textMeshProComponent.set_wordSpacing(fontData.wordSpacing);
                textMeshProComponent.set_lineSpacing(fontData.lineSpacing);
                textMeshProComponent.set_paragraphSpacing(fontData.paragraphSpacing);
            }
        }
Exemplo n.º 3
0
 protected override void OnDestroy()
 {
     if (null != m_textMeshProComponent)
     {
         Object.Destroy(m_textMeshProComponent);
         m_textMeshProComponent = null;
     }
     if (m_fontCollection != null)
     {
         m_fontCollection.Unload();
     }
     this.OnDestroy();
 }