public bool Equals(TextGenerationSettingsEx other)
 {
     if (this.CompareColors(this.color, other.color) && this.fontSize == other.fontSize && Mathf.Approximately(this.SpacingX, other.SpacingX) &&
         (Mathf.Approximately(this.scaleFactor, other.scaleFactor) && (elipsizeEnd == other.elipsizeEnd) &&
          (parseSub == other.parseSub && parseBold == other.parseBold && parseColor == other.parseColor && parseEmoji == other.parseEmoji &&
           parseItatic == other.parseItatic && parseSize == other.parseSize && parseStrikethrough == other.parseStrikethrough && parseSup == other.parseSup &&
           parseUrl == other.parseUrl && parseUnderline == other.parseUnderline) &&
          this.resizeTextMinSize == other.resizeTextMinSize) &&
         (this.resizeTextMaxSize == other.resizeTextMaxSize &&
          Mathf.Approximately(this.lineSpacing, other.lineSpacing) &&
          (this.fontStyle == other.fontStyle && this.richText == other.richText)) &&
         (this.textAnchor == other.textAnchor && this.resizeTextForBestFit == other.resizeTextForBestFit &&
          (this.resizeTextMinSize == other.resizeTextMinSize && this.resizeTextMaxSize == other.resizeTextMaxSize) &&
          (this.resizeTextForBestFit == other.resizeTextForBestFit &&
           (this.horizontalOverflow == other.horizontalOverflow && this.verticalOverflow == other.verticalOverflow))) &&
         (this.CompareVector2(this.generationExtents, other.generationExtents) &&
          this.CompareVector2(this.pivot, other.pivot)))
     {
         return(this.font == other.font);
     }
     return(false);
 }
示例#2
0
        public TextGenerationSettingsEx GetGenerationSettings(Vector2 extents)
        {
            var settings = new TextGenerationSettingsEx();

            settings.generationExtents = extents;
            settings.fontSize          = m_FontData.fontSize;

            //只支持动态字体
            settings.resizeTextMinSize = m_FontData.minSize;
            settings.resizeTextMaxSize = m_FontData.maxSize;

            settings.parseBold          = m_ParseBold;
            settings.parseColor         = m_ParseColor;
            settings.parseEmoji         = m_ParseEmoji;
            settings.parseItatic        = m_ParseItatic;
            settings.parseStrikethrough = m_ParseStrikethrough;
            settings.parseSub           = m_ParseSub;
            settings.parseSup           = m_ParseSup;
            settings.parseUnderline     = m_ParseUnderline;
            settings.parseUrl           = m_ParseUrl;
            settings.parseSize          = m_ParseSize;

            settings.textAnchor           = m_FontData.alignment;
            settings.scaleFactor          = pixelsPerUnit;
            settings.color                = color;
            settings.font                 = font;
            settings.pivot                = rectTransform.pivot;
            settings.richText             = m_FontData.richText;
            settings.SpacingX             = m_SpacingX;
            settings.lineSpacing          = m_FontData.lineSpacing;
            settings.fontStyle            = m_FontData.fontStyle;
            settings.resizeTextForBestFit = m_FontData.bestFit;
            settings.horizontalOverflow   = m_FontData.horizontalOverflow;
            settings.verticalOverflow     = m_FontData.verticalOverflow;
            settings.elipsizeEnd          = m_EllipsizeEnd;
            return(settings);
        }