예제 #1
0
    private void processMarkup()
    {
        this.releaseMarkupReferences();
        this.elements = dfMarkupParser.Parse(this, this.text);
        float         num   = this.getTextScaleMultiplier();
        int           num2  = Mathf.CeilToInt(this.FontSize * num);
        int           num3  = Mathf.CeilToInt(this.LineHeight * num);
        dfMarkupStyle style = new dfMarkupStyle {
            Host               = this,
            Atlas              = this.Atlas,
            Font               = this.Font,
            FontSize           = num2,
            FontStyle          = this.FontStyle,
            LineHeight         = num3,
            Color              = (Color)base.ApplyOpacity(base.Color),
            Opacity            = base.CalculateOpacity(),
            Align              = this.TextAlignment,
            PreserveWhitespace = this.preserveWhitespace
        };
        dfMarkupBox box = new dfMarkupBox(null, dfMarkupDisplayType.block, style)
        {
            Size = base.Size
        };

        this.viewportBox = box;
        for (int i = 0; i < this.elements.Count; i++)
        {
            dfMarkupElement element = this.elements[i];
            if (element != null)
            {
                element.PerformLayout(this.viewportBox, style);
            }
        }
    }
예제 #2
0
 protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
 {
     style = base.applyTextStyleAttributes(style);
     for (int i = 0; i < base.ChildNodes.Count; i++)
     {
         dfMarkupElement item = base.ChildNodes[i];
         if (!(item is dfMarkupString) || !((item as dfMarkupString).Text == "\n"))
         {
             item.PerformLayout(container, style);
         }
         else if (style.PreserveWhitespace)
         {
             container.AddLineBreak();
         }
     }
 }
예제 #3
0
 protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
 {
     style = base.applyTextStyleAttributes(style);
     for (int i = 0; i < base.ChildNodes.Count; i++)
     {
         dfMarkupElement element = base.ChildNodes[i];
         if (element is dfMarkupString)
         {
             dfMarkupString str = element as dfMarkupString;
             if (str.Text == "\n")
             {
                 if (style.PreserveWhitespace)
                 {
                     container.AddLineBreak();
                 }
                 continue;
             }
         }
         element.PerformLayout(container, style);
     }
 }
예제 #4
0
    private void processMarkup()
    {
        this.releaseMarkupReferences();
        this.elements = dfMarkupParser.Parse(this, this.text);
        float         textScaleMultiplier = this.getTextScaleMultiplier();
        int           num            = Mathf.CeilToInt((float)this.FontSize * textScaleMultiplier);
        int           num1           = Mathf.CeilToInt((float)this.LineHeight * textScaleMultiplier);
        dfMarkupStyle _dfMarkupStyle = new dfMarkupStyle();
        dfMarkupStyle atlas          = _dfMarkupStyle;

        atlas.Host               = this;
        atlas.Atlas              = this.Atlas;
        atlas.Font               = this.Font;
        atlas.FontSize           = num;
        atlas.FontStyle          = this.FontStyle;
        atlas.LineHeight         = num1;
        atlas.Color              = base.ApplyOpacity(base.Color);
        atlas.Opacity            = base.CalculateOpacity();
        atlas.Align              = this.TextAlignment;
        atlas.PreserveWhitespace = this.preserveWhitespace;
        _dfMarkupStyle           = atlas;
        dfMarkupBox _dfMarkupBox = new dfMarkupBox(null, dfMarkupDisplayType.block, _dfMarkupStyle)
        {
            Size = base.Size
        };

        this.viewportBox = _dfMarkupBox;
        for (int i = 0; i < this.elements.Count; i++)
        {
            dfMarkupElement item = this.elements[i];
            if (item != null)
            {
                item.PerformLayout(this.viewportBox, _dfMarkupStyle);
            }
        }
    }