예제 #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();
                }
            }
        }
예제 #2
0
        public ITextComponent SetTextAlignment(TextAnchor anchor)
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                TextComponentUGUIAddon.SetTextAlignment(this.text, anchor);
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                TextComponentTMPAddon.SetTextAlignment(this.text, anchor);
            }

            return(this);
        }
예제 #3
0
        public string GetText()
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                return(TextComponentUGUIAddon.GetText(this.text));
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                return(TextComponentTMPAddon.GetText(this.text));
            }

            return(string.Empty);
        }
예제 #4
0
        public ITextComponent SetTextAlignByGeometry(bool state)
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                TextComponentUGUIAddon.SetTextAlignByGeometry(this.text, state);
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                TextComponentTMPAddon.SetTextAlignByGeometry(this.text, state);
            }

            return(this);
        }
예제 #5
0
        public ITextComponent SetTextHorizontalOverflow(HorizontalWrapMode mode)
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                TextComponentUGUIAddon.SetTextHorizontalOverflow(this.text, mode);
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                TextComponentTMPAddon.SetTextHorizontalOverflow(this.text, mode);
            }

            return(this);
        }
예제 #6
0
        public ITextComponent SetRichText(bool state)
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                TextComponentUGUIAddon.SetRichText(this.text, state);
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                TextComponentTMPAddon.SetRichText(this.text, state);
            }

            return(this);
        }
예제 #7
0
        public ITextComponent SetLineSpacing(float value)
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                TextComponentUGUIAddon.SetLineSpacing(this.text, value);
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                TextComponentTMPAddon.SetLineSpacing(this.text, value);
            }

            return(this);
        }
예제 #8
0
        public ITextComponent SetFontSize(int fontSize)
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                TextComponentUGUIAddon.SetFontSize(this.text, fontSize);
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                TextComponentTMPAddon.SetFontSize(this.text, fontSize);
            }

            return(this);
        }
예제 #9
0
        public int GetFontSize()
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                return(TextComponentUGUIAddon.GetFontSize(this.text));
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                return(TextComponentTMPAddon.GetFontSize(this.text));
            }

            return(0);
        }
예제 #10
0
        public ITextComponent SetBestFitMaxSize(int size)
        {
            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                TextComponentUGUIAddon.SetBestFitMaxSize(this.text, size);
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                TextComponentTMPAddon.SetBestFitMaxSize(this.text, size);
            }

            return(this);
        }
예제 #11
0
        public float GetContentHeight(string text, Vector2 containerSize)
        {
            if (this.text == null)
            {
                return(0f);
            }

            if (TextComponentUGUIAddon.IsValid(this.text) == true)
            {
                return(TextComponentUGUIAddon.GetContentHeight(this.text, text, containerSize));
            }
            if (TextComponentTMPAddon.IsValid(this.text) == true)
            {
                return(TextComponentTMPAddon.GetContentHeight(this.text, text, containerSize));
            }

            return(0f);
        }
예제 #12
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);
                }
            }
        }