Ejemplo n.º 1
0
        private void SetText_INTERNAL(string text)
        {
            if (text == null)
            {
                text = string.Empty;
            }

            if (this.text != null)
            {
                bool supportRichText = false;
                if (TextComponentUGUIAddon.IsValid(this.text) == true)
                {
                    supportRichText = TextComponentUGUIAddon.IsRichtextSupported(this.text);
                }
                if (TextComponentTMPAddon.IsValid(this.text) == true)
                {
                    supportRichText = TextComponentTMPAddon.IsRichtextSupported(this.text);
                }

                if (supportRichText == true)
                {
                    text = TextComponent.ParseRichText(text, this.GetFontSize(), this.richTextFlags);
                }

                text = TextComponent.FullTextFormat(text, this.fullTextFormat);

                if (this.lastText == text)
                {
                    return;
                }
                this.lastText = text;

                System.Action onComplete = () => {
                    if (TextComponentUGUIAddon.IsValid(this.text) == true)
                    {
                        TextComponentUGUIAddon.SetText(this.text, text);
                    }
                    if (TextComponentTMPAddon.IsValid(this.text) == true)
                    {
                        TextComponentTMPAddon.SetText(this.text, text);
                    }
                };

                if (this.textCrossFadeModule.IsValid() == true && TextComponentUGUIAddon.IsValid(this.text) == true)
                {
                    this.textCrossFadeModule.Prepare(this);
                    this.textCrossFadeModule.FadeTo(this, text, onComplete);
                }
                else
                {
                    onComplete.Invoke();
                }
            }
        }
Ejemplo n.º 2
0
        private void SetText_INTERNAL(string text)
        {
            if (text == null)
            {
                text = string.Empty;
            }

            if (this.text != null)
            {
                bool supportRichText = false;
                if (TextComponentUGUIAddon.IsValid(this.text) == true)
                {
                    supportRichText = TextComponentUGUIAddon.IsRichtextSupported(this.text);
                }
                if (TextComponentTMPAddon.IsValid(this.text) == true)
                {
                    supportRichText = TextComponentTMPAddon.IsRichtextSupported(this.text);
                }

                if (supportRichText == true)
                {
                    text = TextComponent.ParseRichText(text, this.GetFontSize(), this.richTextFlags);
                }

                text = TextComponent.FullTextFormat(text, this.fullTextFormat);

                if (TextComponentUGUIAddon.IsValid(this.text) == true)
                {
                    TextComponentUGUIAddon.SetText(this.text, text);
                }
                if (TextComponentTMPAddon.IsValid(this.text) == true)
                {
                    TextComponentTMPAddon.SetText(this.text, text);
                }
            }
        }