// Token: 0x0600478D RID: 18317 RVA: 0x0010EB10 File Offset: 0x0010CD10 private void processMarkup() { this.releaseMarkupReferences(); this.elements = global::dfMarkupParser.Parse(this, this.text); float textScaleMultiplier = this.getTextScaleMultiplier(); int num = Mathf.CeilToInt((float)this.FontSize * textScaleMultiplier); int lineHeight = Mathf.CeilToInt((float)this.LineHeight * textScaleMultiplier); global::dfMarkupStyle style = new global::dfMarkupStyle { Host = this, Atlas = this.Atlas, Font = this.Font, FontSize = num, FontStyle = this.FontStyle, LineHeight = lineHeight, Color = base.ApplyOpacity(base.Color), Opacity = base.CalculateOpacity(), Align = this.TextAlignment, PreserveWhitespace = this.preserveWhitespace }; this.viewportBox = new global::dfMarkupBox(null, global::dfMarkupDisplayType.block, style) { Size = base.Size }; for (int i = 0; i < this.elements.Count; i++) { global::dfMarkupElement dfMarkupElement = this.elements[i]; if (dfMarkupElement != null) { dfMarkupElement.PerformLayout(this.viewportBox, style); } } }
// Token: 0x0600472C RID: 18220 RVA: 0x0010D1C8 File Offset: 0x0010B3C8 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { style.TextDecoration = global::dfMarkupTextDecoration.Underline; style = base.applyTextStyleAttributes(style); int i = 0; while (i < base.ChildNodes.Count) { global::dfMarkupElement dfMarkupElement = base.ChildNodes[i]; if (!(dfMarkupElement is global::dfMarkupString)) { goto IL_63; } global::dfMarkupString dfMarkupString = dfMarkupElement as global::dfMarkupString; if (!(dfMarkupString.Text == "\n")) { goto IL_63; } if (style.PreserveWhitespace) { container.AddLineBreak(); } IL_6B: i++; continue; IL_63: dfMarkupElement.PerformLayout(container, style); goto IL_6B; } }
// Token: 0x0600474B RID: 18251 RVA: 0x0010DB94 File Offset: 0x0010BD94 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { if (base.Owner == null) { Debug.LogError("Tag has no parent: " + this); return; } style = this.applyStyleAttributes(style); global::dfMarkupAttribute dfMarkupAttribute = base.findAttribute(new string[] { "src" }); if (dfMarkupAttribute == null) { return; } string value = dfMarkupAttribute.Value; global::dfMarkupBox dfMarkupBox = this.createImageBox(base.Owner.Atlas, value, style); if (dfMarkupBox == null) { return; } Vector2 size = Vector2.zero; global::dfMarkupAttribute dfMarkupAttribute2 = base.findAttribute(new string[] { "height" }); if (dfMarkupAttribute2 != null) { size.y = (float)global::dfMarkupStyle.ParseSize(dfMarkupAttribute2.Value, (int)dfMarkupBox.Size.y); } global::dfMarkupAttribute dfMarkupAttribute3 = base.findAttribute(new string[] { "width" }); if (dfMarkupAttribute3 != null) { size.x = (float)global::dfMarkupStyle.ParseSize(dfMarkupAttribute3.Value, (int)dfMarkupBox.Size.x); } if (size.sqrMagnitude <= 1.401298E-45f) { size = dfMarkupBox.Size; } else if (size.x <= 1.401298E-45f) { size.x = size.y * (dfMarkupBox.Size.x / dfMarkupBox.Size.y); } else if (size.y <= 1.401298E-45f) { size.y = size.x * (dfMarkupBox.Size.y / dfMarkupBox.Size.x); } dfMarkupBox.Size = size; dfMarkupBox.Baseline = (int)size.y; container.AddChild(dfMarkupBox); }
// Token: 0x0600471F RID: 18207 RVA: 0x0010CC94 File Offset: 0x0010AE94 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { if (this.IsEndTag) { return; } for (int i = 0; i < base.ChildNodes.Count; i++) { base.ChildNodes[i].PerformLayout(container, style); } }
// Token: 0x060046E7 RID: 18151 RVA: 0x0010BC34 File Offset: 0x00109E34 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { if (style.Font == null) { return; } string text = (!style.PreserveWhitespace && this.isWhitespace) ? " " : this.Text; global::dfMarkupBoxText dfMarkupBoxText = global::dfMarkupBoxText.Obtain(this, global::dfMarkupDisplayType.inline, style); dfMarkupBoxText.SetText(text); container.AddChild(dfMarkupBoxText); }
// Token: 0x06004742 RID: 18242 RVA: 0x0010D9D4 File Offset: 0x0010BBD4 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { style = base.applyTextStyleAttributes(style); if (style.FontStyle == null) { style.FontStyle = 2; } else if (style.FontStyle == 1) { style.FontStyle = 3; } base._PerformLayoutImpl(container, style); }
// Token: 0x06004735 RID: 18229 RVA: 0x0010D434 File Offset: 0x0010B634 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { if (base.ChildNodes.Count == 0) { return; } float x = container.Size.x; global::dfMarkupBox dfMarkupBox = new global::dfMarkupBox(this, global::dfMarkupDisplayType.listItem, style); dfMarkupBox.Margins.top = 10; container.AddChild(dfMarkupBox); global::dfMarkupTagList dfMarkupTagList = base.Parent as global::dfMarkupTagList; if (dfMarkupTagList == null) { base._PerformLayoutImpl(container, style); return; } style.VerticalAlign = global::dfMarkupVerticalAlign.Baseline; string text = "•"; if (dfMarkupTagList.TagName == "ol") { text = container.Children.Count + "."; } global::dfMarkupStyle style2 = style; style2.VerticalAlign = global::dfMarkupVerticalAlign.Baseline; style2.Align = global::dfMarkupTextAlign.Right; global::dfMarkupBoxText dfMarkupBoxText = global::dfMarkupBoxText.Obtain(this, global::dfMarkupDisplayType.inlineBlock, style2); dfMarkupBoxText.SetText(text); dfMarkupBoxText.Width = dfMarkupTagList.BulletWidth; dfMarkupBoxText.Margins.left = style.FontSize * 2; dfMarkupBox.AddChild(dfMarkupBoxText); global::dfMarkupBox dfMarkupBox2 = new global::dfMarkupBox(this, global::dfMarkupDisplayType.inlineBlock, style); int fontSize = style.FontSize; float num = x - dfMarkupBoxText.Size.x - (float)dfMarkupBoxText.Margins.left - (float)fontSize; dfMarkupBox2.Size = new Vector2(num, (float)fontSize); dfMarkupBox2.Margins.left = (int)((float)style.FontSize * 0.5f); dfMarkupBox.AddChild(dfMarkupBox2); for (int i = 0; i < base.ChildNodes.Count; i++) { base.ChildNodes[i].PerformLayout(dfMarkupBox2, style); } dfMarkupBox2.FitToContents(false); dfMarkupBox2.Parent.FitToContents(false); dfMarkupBox.FitToContents(false); }
// Token: 0x06004738 RID: 18232 RVA: 0x0010D5FC File Offset: 0x0010B7FC protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { if (base.ChildNodes.Count == 0) { return; } style = base.applyTextStyleAttributes(style); int top = (container.Children.Count != 0) ? style.LineHeight : 0; global::dfMarkupBox dfMarkupBox; if (style.BackgroundColor.a > 0.005f) { global::dfMarkupBoxSprite dfMarkupBoxSprite = new global::dfMarkupBoxSprite(this, global::dfMarkupDisplayType.block, style); dfMarkupBoxSprite.Atlas = base.Owner.Atlas; dfMarkupBoxSprite.Source = base.Owner.BlankTextureSprite; dfMarkupBoxSprite.Style.Color = style.BackgroundColor; dfMarkupBox = dfMarkupBoxSprite; } else { dfMarkupBox = new global::dfMarkupBox(this, global::dfMarkupDisplayType.block, style); } dfMarkupBox.Margins = new global::dfMarkupBorders(0, 0, top, style.LineHeight); global::dfMarkupAttribute dfMarkupAttribute = base.findAttribute(new string[] { "margin" }); if (dfMarkupAttribute != null) { dfMarkupBox.Margins = global::dfMarkupBorders.Parse(dfMarkupAttribute.Value); } global::dfMarkupAttribute dfMarkupAttribute2 = base.findAttribute(new string[] { "padding" }); if (dfMarkupAttribute2 != null) { dfMarkupBox.Padding = global::dfMarkupBorders.Parse(dfMarkupAttribute2.Value); } container.AddChild(dfMarkupBox); base._PerformLayoutImpl(dfMarkupBox, style); if (dfMarkupBox.Children.Count > 0) { dfMarkupBox.Children[dfMarkupBox.Children.Count - 1].IsNewline = true; } dfMarkupBox.FitToContents(true); }
// Token: 0x0600473F RID: 18239 RVA: 0x0010D854 File Offset: 0x0010BA54 private global::dfMarkupStyle applyDefaultStyles(global::dfMarkupStyle style, ref global::dfMarkupBorders margins) { float num = 1f; float num2 = 1f; string tagName = base.TagName; switch (tagName) { case "h1": num2 = 2f; num = 0.65f; break; case "h2": num2 = 1.5f; num = 0.75f; break; case "h3": num2 = 1.35f; num = 0.85f; break; case "h4": num2 = 1.15f; num = 0f; break; case "h5": num2 = 0.85f; num = 1.5f; break; case "h6": num2 = 0.75f; num = 1.75f; break; } style.FontSize = (int)((float)style.FontSize * num2); style.FontStyle = 1; style.Align = global::dfMarkupTextAlign.Left; num *= (float)style.FontSize; int top = margins.bottom = (int)num; margins.top = top; return(style); }
// Token: 0x06004745 RID: 18245 RVA: 0x0010DA3C File Offset: 0x0010BC3C protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { style = base.applyTextStyleAttributes(style); style.PreserveWhitespace = true; style.Preformatted = true; if (style.Align == global::dfMarkupTextAlign.Justify) { style.Align = global::dfMarkupTextAlign.Left; } global::dfMarkupBox dfMarkupBox; if (style.BackgroundColor.a > 0.1f) { global::dfMarkupBoxSprite dfMarkupBoxSprite = new global::dfMarkupBoxSprite(this, global::dfMarkupDisplayType.block, style); dfMarkupBoxSprite.LoadImage(base.Owner.Atlas, base.Owner.BlankTextureSprite); dfMarkupBoxSprite.Style.Color = style.BackgroundColor; dfMarkupBox = dfMarkupBoxSprite; } else { dfMarkupBox = new global::dfMarkupBox(this, global::dfMarkupDisplayType.block, style); } global::dfMarkupAttribute dfMarkupAttribute = base.findAttribute(new string[] { "margin" }); if (dfMarkupAttribute != null) { dfMarkupBox.Margins = global::dfMarkupBorders.Parse(dfMarkupAttribute.Value); } global::dfMarkupAttribute dfMarkupAttribute2 = base.findAttribute(new string[] { "padding" }); if (dfMarkupAttribute2 != null) { dfMarkupBox.Padding = global::dfMarkupBorders.Parse(dfMarkupAttribute2.Value); } container.AddChild(dfMarkupBox); base._PerformLayoutImpl(dfMarkupBox, style); dfMarkupBox.FitToContents(false); }
// Token: 0x06004750 RID: 18256 RVA: 0x0010DE58 File Offset: 0x0010C058 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { global::dfMarkupAttribute dfMarkupAttribute = base.findAttribute(new string[] { "name", "face" }); if (dfMarkupAttribute != null) { style.Font = (global::dfDynamicFont.FindByName(dfMarkupAttribute.Value) ?? style.Font); } global::dfMarkupAttribute dfMarkupAttribute2 = base.findAttribute(new string[] { "size", "font-size" }); if (dfMarkupAttribute2 != null) { style.FontSize = global::dfMarkupStyle.ParseSize(dfMarkupAttribute2.Value, style.FontSize); } global::dfMarkupAttribute dfMarkupAttribute3 = base.findAttribute(new string[] { "color" }); if (dfMarkupAttribute3 != null) { style.Color = global::dfMarkupStyle.ParseColor(dfMarkupAttribute3.Value, Color.red); style.Color.a = style.Opacity; } global::dfMarkupAttribute dfMarkupAttribute4 = base.findAttribute(new string[] { "style" }); if (dfMarkupAttribute4 != null) { style.FontStyle = global::dfMarkupStyle.ParseFontStyle(dfMarkupAttribute4.Value, style.FontStyle); } base._PerformLayoutImpl(container, style); }
// Token: 0x06004731 RID: 18225 RVA: 0x0010D288 File Offset: 0x0010B488 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { if (base.ChildNodes.Count == 0) { return; } style.Align = global::dfMarkupTextAlign.Left; global::dfMarkupBox dfMarkupBox = new global::dfMarkupBox(this, global::dfMarkupDisplayType.block, style); container.AddChild(dfMarkupBox); this.calculateBulletWidth(style); for (int i = 0; i < base.ChildNodes.Count; i++) { global::dfMarkupTag dfMarkupTag = base.ChildNodes[i] as global::dfMarkupTag; if (dfMarkupTag != null && !(dfMarkupTag.TagName != "li")) { dfMarkupTag.PerformLayout(dfMarkupBox, style); } } dfMarkupBox.FitToContents(false); }
// Token: 0x06004732 RID: 18226 RVA: 0x0010D324 File Offset: 0x0010B524 private void calculateBulletWidth(global::dfMarkupStyle style) { if (base.TagName == "ul") { this.BulletWidth = Mathf.CeilToInt(style.Font.MeasureText("•", style.FontSize, style.FontStyle).x); return; } int num = 0; for (int i = 0; i < base.ChildNodes.Count; i++) { global::dfMarkupTag dfMarkupTag = base.ChildNodes[i] as global::dfMarkupTag; if (dfMarkupTag != null && dfMarkupTag.TagName == "li") { num++; } } string text = new string('X', num.ToString().Length) + "."; this.BulletWidth = Mathf.CeilToInt(style.Font.MeasureText(text, style.FontSize, style.FontStyle).x); }
// Token: 0x0600474D RID: 18253 RVA: 0x0010DDC0 File Offset: 0x0010BFC0 private global::dfMarkupBox createImageBox(global::dfAtlas atlas, string source, global::dfMarkupStyle style) { if (source.ToLowerInvariant().StartsWith("http://")) { return(null); } if (atlas != null && atlas[source] != null) { global::dfMarkupBoxSprite dfMarkupBoxSprite = new global::dfMarkupBoxSprite(this, global::dfMarkupDisplayType.inline, style); dfMarkupBoxSprite.LoadImage(atlas, source); return(dfMarkupBoxSprite); } Texture texture = global::dfMarkupImageCache.Load(source); if (texture != null) { global::dfMarkupBoxTexture dfMarkupBoxTexture = new global::dfMarkupBoxTexture(this, global::dfMarkupDisplayType.inline, style); dfMarkupBoxTexture.LoadTexture(texture); return(dfMarkupBoxTexture); } return(null); }
// Token: 0x0600473E RID: 18238 RVA: 0x0010D7E0 File Offset: 0x0010B9E0 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { global::dfMarkupBorders margins = default(global::dfMarkupBorders); global::dfMarkupStyle style2 = this.applyDefaultStyles(style, ref margins); style2 = base.applyTextStyleAttributes(style2); global::dfMarkupAttribute dfMarkupAttribute = base.findAttribute(new string[] { "margin" }); if (dfMarkupAttribute != null) { margins = global::dfMarkupBorders.Parse(dfMarkupAttribute.Value); } global::dfMarkupBox dfMarkupBox = new global::dfMarkupBox(this, global::dfMarkupDisplayType.block, style2); dfMarkupBox.Margins = margins; container.AddChild(dfMarkupBox); base._PerformLayoutImpl(dfMarkupBox, style2); dfMarkupBox.FitToContents(false); }
// Token: 0x0600474C RID: 18252 RVA: 0x0010DD38 File Offset: 0x0010BF38 private global::dfMarkupStyle applyStyleAttributes(global::dfMarkupStyle style) { global::dfMarkupAttribute dfMarkupAttribute = base.findAttribute(new string[] { "valign" }); if (dfMarkupAttribute != null) { style.VerticalAlign = global::dfMarkupStyle.ParseVerticalAlignment(dfMarkupAttribute.Value); } global::dfMarkupAttribute dfMarkupAttribute2 = base.findAttribute(new string[] { "color" }); if (dfMarkupAttribute2 != null) { Color color = global::dfMarkupStyle.ParseColor(dfMarkupAttribute2.Value, base.Owner.Color); color.a = style.Opacity; style.Color = color; } return(style); }
// Token: 0x060046DF RID: 18143 protected abstract void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style);
// Token: 0x06004748 RID: 18248 RVA: 0x0010DB68 File Offset: 0x0010BD68 protected override void _PerformLayoutImpl(global::dfMarkupBox container, global::dfMarkupStyle style) { container.AddLineBreak(); }
// Token: 0x06004720 RID: 18208 RVA: 0x0010CCDC File Offset: 0x0010AEDC protected global::dfMarkupStyle applyTextStyleAttributes(global::dfMarkupStyle style) { global::dfMarkupAttribute dfMarkupAttribute = this.findAttribute(new string[] { "font", "font-family" }); if (dfMarkupAttribute != null) { style.Font = global::dfDynamicFont.FindByName(dfMarkupAttribute.Value); } global::dfMarkupAttribute dfMarkupAttribute2 = this.findAttribute(new string[] { "style", "font-style" }); if (dfMarkupAttribute2 != null) { style.FontStyle = global::dfMarkupStyle.ParseFontStyle(dfMarkupAttribute2.Value, style.FontStyle); } global::dfMarkupAttribute dfMarkupAttribute3 = this.findAttribute(new string[] { "size", "font-size" }); if (dfMarkupAttribute3 != null) { style.FontSize = global::dfMarkupStyle.ParseSize(dfMarkupAttribute3.Value, style.FontSize); } global::dfMarkupAttribute dfMarkupAttribute4 = this.findAttribute(new string[] { "color" }); if (dfMarkupAttribute4 != null) { Color color = global::dfMarkupStyle.ParseColor(dfMarkupAttribute4.Value, style.Color); color.a = style.Opacity; style.Color = color; } global::dfMarkupAttribute dfMarkupAttribute5 = this.findAttribute(new string[] { "align", "text-align" }); if (dfMarkupAttribute5 != null) { style.Align = global::dfMarkupStyle.ParseTextAlignment(dfMarkupAttribute5.Value); } global::dfMarkupAttribute dfMarkupAttribute6 = this.findAttribute(new string[] { "valign", "vertical-align" }); if (dfMarkupAttribute6 != null) { style.VerticalAlign = global::dfMarkupStyle.ParseVerticalAlignment(dfMarkupAttribute6.Value); } global::dfMarkupAttribute dfMarkupAttribute7 = this.findAttribute(new string[] { "line-height" }); if (dfMarkupAttribute7 != null) { style.LineHeight = global::dfMarkupStyle.ParseSize(dfMarkupAttribute7.Value, style.LineHeight); } global::dfMarkupAttribute dfMarkupAttribute8 = this.findAttribute(new string[] { "text-decoration" }); if (dfMarkupAttribute8 != null) { style.TextDecoration = global::dfMarkupStyle.ParseTextDecoration(dfMarkupAttribute8.Value); } global::dfMarkupAttribute dfMarkupAttribute9 = this.findAttribute(new string[] { "background", "background-color" }); if (dfMarkupAttribute9 != null) { style.BackgroundColor = global::dfMarkupStyle.ParseColor(dfMarkupAttribute9.Value, Color.clear); style.BackgroundColor.a = style.Opacity; } return(style); }
// Token: 0x0600469A RID: 18074 RVA: 0x00109D58 File Offset: 0x00107F58 public dfMarkupBox(global::dfMarkupElement element, global::dfMarkupDisplayType display, global::dfMarkupStyle style) { this.Element = element; this.Display = display; this.Style = style; this.Baseline = style.FontSize; }
// Token: 0x060046DD RID: 18141 RVA: 0x0010BA84 File Offset: 0x00109C84 public void PerformLayout(global::dfMarkupBox container, global::dfMarkupStyle style) { this._PerformLayoutImpl(container, style); }
// Token: 0x060046CA RID: 18122 RVA: 0x0010B30C File Offset: 0x0010950C public static global::dfMarkupBoxText Obtain(global::dfMarkupElement element, global::dfMarkupDisplayType display, global::dfMarkupStyle style) { if (global::dfMarkupBoxText.objectPool.Count > 0) { global::dfMarkupBoxText dfMarkupBoxText = global::dfMarkupBoxText.objectPool.Dequeue(); dfMarkupBoxText.Element = element; dfMarkupBoxText.Display = display; dfMarkupBoxText.Style = style; dfMarkupBoxText.Position = Vector2.zero; dfMarkupBoxText.Size = Vector2.zero; dfMarkupBoxText.Baseline = (int)((float)style.FontSize * 1.1f); dfMarkupBoxText.Margins = default(global::dfMarkupBorders); dfMarkupBoxText.Padding = default(global::dfMarkupBorders); return(dfMarkupBoxText); } return(new global::dfMarkupBoxText(element, display, style)); }
// Token: 0x060046B4 RID: 18100 RVA: 0x0010AD8C File Offset: 0x00108F8C public dfMarkupBoxSprite(global::dfMarkupElement element, global::dfMarkupDisplayType display, global::dfMarkupStyle style) : base(element, display, style) { }