public bool PopulateWithErrors(string str, TextGenerationSettings settings, GameObject context)
        {
            TextGenerationError textGenerationError = this.PopulateWithError(str, settings);
            bool result;

            if (textGenerationError == TextGenerationError.None)
            {
                result = true;
            }
            else
            {
                if ((textGenerationError & TextGenerationError.CustomSizeOnNonDynamicFont) != TextGenerationError.None)
                {
                    Debug.LogErrorFormat(context, "Font '{0}' is not dynamic, which is required to override its size", new object[]
                    {
                        settings.font
                    });
                }
                if ((textGenerationError & TextGenerationError.CustomStyleOnNonDynamicFont) != TextGenerationError.None)
                {
                    Debug.LogErrorFormat(context, "Font '{0}' is not dynamic, which is required to override its style", new object[]
                    {
                        settings.font
                    });
                }
                result = false;
            }
            return(result);
        }
        internal bool Populate_Internal(
            string str, Font font, Color color,
            int fontSize, float scaleFactor, float lineSpacing, FontStyle style, bool richText,
            bool resizeTextForBestFit, int resizeTextMinSize, int resizeTextMaxSize,
            VerticalWrapMode verticalOverFlow, HorizontalWrapMode horizontalOverflow, bool updateBounds,
            TextAnchor anchor, Vector2 extents, Vector2 pivot, bool generateOutOfBounds, bool alignByGeometry,
            out TextGenerationError error)
        {
            if (font == null)
            {
                error = TextGenerationError.NoFont;
                return(false);
            }

            uint uerror = 0;
            bool res    = Populate_Internal(
                str, font, color,
                fontSize, scaleFactor, lineSpacing, style, richText,
                resizeTextForBestFit, resizeTextMinSize, resizeTextMaxSize,
                (int)verticalOverFlow, (int)horizontalOverflow, updateBounds,
                anchor, extents.x, extents.y, pivot.x, pivot.y, generateOutOfBounds, alignByGeometry, out uerror);

            error = (TextGenerationError)uerror;
            return(res);
        }
Esempio n. 3
0
 private TextGenerationError PopulateWithError(string str, TextGenerationSettings settings)
 {
     if ((!this.m_HasGenerated || (str != this.m_LastString)) || !settings.Equals(this.m_LastSettings))
     {
         this.m_LastValid = this.PopulateAlways(str, settings);
     }
     return(this.m_LastValid);
 }
Esempio n. 4
0
 private TextGenerationError PopulateWithError(string str, TextGenerationSettings settings)
 {
     if (m_HasGenerated && str == m_LastString && settings.Equals(m_LastSettings))
     {
         return(m_LastValid);
     }
     m_LastValid = PopulateAlways(str, settings);
     return(m_LastValid);
 }
Esempio n. 5
0
        private TextGenerationError PopulateAlways(string str, TextGenerationSettings settings)
        {
            m_LastString       = str;
            m_HasGenerated     = true;
            m_CachedVerts      = false;
            m_CachedCharacters = false;
            m_CachedLines      = false;
            m_LastSettings     = settings;
            TextGenerationSettings textGenerationSettings = ValidatedSettings(settings);

            Populate_Internal(str, textGenerationSettings.font, textGenerationSettings.color, textGenerationSettings.fontSize, textGenerationSettings.scaleFactor, textGenerationSettings.lineSpacing, textGenerationSettings.fontStyle, textGenerationSettings.richText, textGenerationSettings.resizeTextForBestFit, textGenerationSettings.resizeTextMinSize, textGenerationSettings.resizeTextMaxSize, textGenerationSettings.verticalOverflow, textGenerationSettings.horizontalOverflow, textGenerationSettings.updateBounds, textGenerationSettings.textAnchor, textGenerationSettings.generationExtents, textGenerationSettings.pivot, textGenerationSettings.generateOutOfBounds, textGenerationSettings.alignByGeometry, out TextGenerationError error);
            m_LastValid = error;
            return(error);
        }
        private TextGenerationError PopulateWithError(string str, TextGenerationSettings settings)
        {
            TextGenerationError lastValid;

            if (this.m_HasGenerated && str == this.m_LastString && settings.Equals(this.m_LastSettings))
            {
                lastValid = this.m_LastValid;
            }
            else
            {
                this.m_LastValid = this.PopulateAlways(str, settings);
                lastValid        = this.m_LastValid;
            }
            return(lastValid);
        }
Esempio n. 7
0
        public bool PopulateWithErrors(string str, TextGenerationSettings settings, GameObject context)
        {
            TextGenerationError textGenerationError = PopulateWithError(str, settings);

            if (textGenerationError == TextGenerationError.None)
            {
                return(true);
            }
            if ((textGenerationError & TextGenerationError.CustomSizeOnNonDynamicFont) != 0)
            {
                Debug.LogErrorFormat(context, "Font '{0}' is not dynamic, which is required to override its size", settings.font);
            }
            if ((textGenerationError & TextGenerationError.CustomStyleOnNonDynamicFont) != 0)
            {
                Debug.LogErrorFormat(context, "Font '{0}' is not dynamic, which is required to override its style", settings.font);
            }
            return(false);
        }
Esempio n. 8
0
        /// <summary>
        /// <para>Will generate the vertices and other data for the given string with the given settings.</para>
        /// </summary>
        /// <param name="str">String to generate.</param>
        /// <param name="settings">Generation settings.</param>
        /// <param name="context">The object used as context of the error log message, if necessary.</param>
        /// <returns>
        /// <para>True if the generation is a success, false otherwise.</para>
        /// </returns>
        public bool PopulateWithErrors(string str, TextGenerationSettings settings, GameObject context)
        {
            TextGenerationError error = this.PopulateWithError(str, settings);

            if (error == TextGenerationError.None)
            {
                return(true);
            }
            if ((error & TextGenerationError.CustomSizeOnNonDynamicFont) != TextGenerationError.None)
            {
                object[] args = new object[] { settings.font };
                Debug.LogErrorFormat(context, "Font '{0}' is not dynamic, which is required to override its size", args);
            }
            if ((error & TextGenerationError.CustomStyleOnNonDynamicFont) != TextGenerationError.None)
            {
                object[] objArray2 = new object[] { settings.font };
                Debug.LogErrorFormat(context, "Font '{0}' is not dynamic, which is required to override its style", objArray2);
            }
            return(false);
        }
        public bool Populate(string str, TextGenerationSettings settings)
        {
            TextGenerationError textGenerationError = this.PopulateWithError(str, settings);

            return(textGenerationError == TextGenerationError.None);
        }
Esempio n. 10
0
        internal bool Populate_Internal(string str, Font font, Color color, int fontSize, float scaleFactor, float lineSpacing, FontStyle style, bool richText, bool resizeTextForBestFit, int resizeTextMinSize, int resizeTextMaxSize, VerticalWrapMode verticalOverFlow, HorizontalWrapMode horizontalOverflow, bool updateBounds, TextAnchor anchor, Vector2 extents, Vector2 pivot, bool generateOutOfBounds, bool alignByGeometry, out TextGenerationError error)
        {
            uint num    = 0u;
            bool result = this.Populate_Internal_cpp(str, font, color, fontSize, scaleFactor, lineSpacing, style, richText, resizeTextForBestFit, resizeTextMinSize, resizeTextMaxSize, (int)verticalOverFlow, (int)horizontalOverflow, updateBounds, anchor, extents.x, extents.y, pivot.x, pivot.y, generateOutOfBounds, alignByGeometry, out num);

            error = (TextGenerationError)num;
            return(result);
        }
Esempio n. 11
0
 internal bool Populate_Internal(string str, Font font, Color color, int fontSize, float scaleFactor, float lineSpacing, FontStyle style, bool richText, bool resizeTextForBestFit, int resizeTextMinSize, int resizeTextMaxSize, VerticalWrapMode verticalOverFlow, HorizontalWrapMode horizontalOverflow, bool updateBounds, TextAnchor anchor, Vector2 extents, Vector2 pivot, bool generateOutOfBounds, bool alignByGeometry, out TextGenerationError error)
 {
     uint num = 0;
     bool flag = this.Populate_Internal_cpp(str, font, color, fontSize, scaleFactor, lineSpacing, style, richText, resizeTextForBestFit, resizeTextMinSize, resizeTextMaxSize, (int) verticalOverFlow, (int) horizontalOverflow, updateBounds, anchor, extents.x, extents.y, pivot.x, pivot.y, generateOutOfBounds, alignByGeometry, out num);
     error = (TextGenerationError) num;
     return flag;
 }
Esempio n. 12
0
 private TextGenerationError PopulateAlways(string str, TextGenerationSettings settings)
 {
     TextGenerationError error;
     this.m_LastString = str;
     this.m_HasGenerated = true;
     this.m_CachedVerts = false;
     this.m_CachedCharacters = false;
     this.m_CachedLines = false;
     this.m_LastSettings = settings;
     TextGenerationSettings settings2 = this.ValidatedSettings(settings);
     this.Populate_Internal(str, settings2.font, settings2.color, settings2.fontSize, settings2.scaleFactor, settings2.lineSpacing, settings2.fontStyle, settings2.richText, settings2.resizeTextForBestFit, settings2.resizeTextMinSize, settings2.resizeTextMaxSize, settings2.verticalOverflow, settings2.horizontalOverflow, settings2.updateBounds, settings2.textAnchor, settings2.generationExtents, settings2.pivot, settings2.generateOutOfBounds, settings2.alignByGeometry, out error);
     this.m_LastValid = error;
     return error;
 }
Esempio n. 13
0
 private TextGenerationError PopulateWithError(string str, TextGenerationSettings settings)
 {
     if ((!this.m_HasGenerated || (str != this.m_LastString)) || !settings.Equals(this.m_LastSettings))
     {
         this.m_LastValid = this.PopulateAlways(str, settings);
     }
     return this.m_LastValid;
 }