protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { dfMarkupAttribute _dfMarkupAttribute = base.findAttribute(new string[] { "name", "face" }); if (_dfMarkupAttribute != null) { style.Font = dfDynamicFont.FindByName(_dfMarkupAttribute.Value) ?? style.Font; } dfMarkupAttribute _dfMarkupAttribute1 = base.findAttribute(new string[] { "size", "font-size" }); if (_dfMarkupAttribute1 != null) { style.FontSize = dfMarkupStyle.ParseSize(_dfMarkupAttribute1.Value, style.FontSize); } dfMarkupAttribute _dfMarkupAttribute2 = base.findAttribute(new string[] { "color" }); if (_dfMarkupAttribute2 != null) { style.Color = dfMarkupStyle.ParseColor(_dfMarkupAttribute2.Value, Color.red); style.Color.a = style.Opacity; } dfMarkupAttribute _dfMarkupAttribute3 = base.findAttribute(new string[] { "style" }); if (_dfMarkupAttribute3 != null) { style.FontStyle = dfMarkupStyle.ParseFontStyle(_dfMarkupAttribute3.Value, style.FontStyle); } base._PerformLayoutImpl(container, style); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (base.Owner == null) { Debug.LogError(string.Concat("Tag has no parent: ", this)); return; } style = this.applyStyleAttributes(style); dfMarkupAttribute _dfMarkupAttribute = base.findAttribute(new string[] { "src" }); if (_dfMarkupAttribute == null) { return; } string value = _dfMarkupAttribute.Value; dfMarkupBox _dfMarkupBox = this.createImageBox(base.Owner.Atlas, value, style); if (_dfMarkupBox == null) { return; } Vector2 size = Vector2.zero; dfMarkupAttribute _dfMarkupAttribute1 = base.findAttribute(new string[] { "height" }); if (_dfMarkupAttribute1 != null) { size.y = (float)dfMarkupStyle.ParseSize(_dfMarkupAttribute1.Value, (int)_dfMarkupBox.Size.y); } dfMarkupAttribute _dfMarkupAttribute2 = base.findAttribute(new string[] { "width" }); if (_dfMarkupAttribute2 != null) { size.x = (float)dfMarkupStyle.ParseSize(_dfMarkupAttribute2.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); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (base.Owner == null) { Debug.LogError("Tag has no parent: " + this); } else { style = this.applyStyleAttributes(style); string[] names = new string[] { "src" }; dfMarkupAttribute attribute = base.findAttribute(names); if (attribute != null) { string source = attribute.Value; dfMarkupBox box = this.createImageBox(base.Owner.Atlas, source, style); if (box != null) { Vector2 zero = Vector2.zero; string[] textArray2 = new string[] { "height" }; dfMarkupAttribute attribute2 = base.findAttribute(textArray2); if (attribute2 != null) { zero.y = dfMarkupStyle.ParseSize(attribute2.Value, (int)box.Size.y); } string[] textArray3 = new string[] { "width" }; dfMarkupAttribute attribute3 = base.findAttribute(textArray3); if (attribute3 != null) { zero.x = dfMarkupStyle.ParseSize(attribute3.Value, (int)box.Size.x); } if (zero.sqrMagnitude <= float.Epsilon) { zero = box.Size; } else if (zero.x <= float.Epsilon) { zero.x = zero.y * (box.Size.x / box.Size.y); } else if (zero.y <= float.Epsilon) { zero.y = zero.x * (box.Size.y / box.Size.x); } box.Size = zero; box.Baseline = (int)zero.y; container.AddChild(box); } } } }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (base.ChildNodes.Count == 0) { return; } style = base.applyTextStyleAttributes(style); int num = (container.Children.Count != 0 ? style.LineHeight : 0); dfMarkupBox _dfMarkupBox = null; if (style.BackgroundColor.a <= 0.005f) { _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.block, style); } else { dfMarkupBoxSprite _dfMarkupBoxSprite = new dfMarkupBoxSprite(this, dfMarkupDisplayType.block, style) { Atlas = base.Owner.Atlas, Source = base.Owner.BlankTextureSprite }; _dfMarkupBoxSprite.Style.Color = style.BackgroundColor; _dfMarkupBox = _dfMarkupBoxSprite; } _dfMarkupBox.Margins = new dfMarkupBorders(0, 0, num, style.LineHeight); dfMarkupAttribute _dfMarkupAttribute = base.findAttribute(new string[] { "margin" }); if (_dfMarkupAttribute != null) { _dfMarkupBox.Margins = dfMarkupBorders.Parse(_dfMarkupAttribute.Value); } dfMarkupAttribute _dfMarkupAttribute1 = base.findAttribute(new string[] { "padding" }); if (_dfMarkupAttribute1 != null) { _dfMarkupBox.Padding = dfMarkupBorders.Parse(_dfMarkupAttribute1.Value); } container.AddChild(_dfMarkupBox); base._PerformLayoutImpl(_dfMarkupBox, style); if (_dfMarkupBox.Children.Count > 0) { _dfMarkupBox.Children[_dfMarkupBox.Children.Count - 1].IsNewline = true; } _dfMarkupBox.FitToContents(true); }
private dfMarkupStyle applyStyleAttributes(dfMarkupStyle style) { dfMarkupAttribute _dfMarkupAttribute = base.findAttribute(new string[] { "valign" }); if (_dfMarkupAttribute != null) { style.VerticalAlign = dfMarkupStyle.ParseVerticalAlignment(_dfMarkupAttribute.Value); } dfMarkupAttribute _dfMarkupAttribute1 = base.findAttribute(new string[] { "color" }); if (_dfMarkupAttribute1 != null) { Color opacity = dfMarkupStyle.ParseColor(_dfMarkupAttribute1.Value, base.Owner.Color); opacity.a = style.Opacity; style.Color = opacity; } return(style); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { if (base.ChildNodes.Count != 0) { style = base.applyTextStyleAttributes(style); int top = (container.Children.Count != 0) ? style.LineHeight : 0; dfMarkupBox box = null; if (style.BackgroundColor.a > 0.005f) { dfMarkupBoxSprite sprite = new dfMarkupBoxSprite(this, dfMarkupDisplayType.block, style) { Atlas = base.Owner.Atlas, Source = base.Owner.BlankTextureSprite }; sprite.Style.Color = style.BackgroundColor; box = sprite; } else { box = new dfMarkupBox(this, dfMarkupDisplayType.block, style); } box.Margins = new dfMarkupBorders(0, 0, top, style.LineHeight); string[] names = new string[] { "margin" }; dfMarkupAttribute attribute = base.findAttribute(names); if (attribute != null) { box.Margins = dfMarkupBorders.Parse(attribute.Value); } string[] textArray2 = new string[] { "padding" }; dfMarkupAttribute attribute2 = base.findAttribute(textArray2); if (attribute2 != null) { box.Padding = dfMarkupBorders.Parse(attribute2.Value); } container.AddChild(box); base._PerformLayoutImpl(box, style); if (box.Children.Count > 0) { box.Children[box.Children.Count - 1].IsNewline = true; } box.FitToContents(true); } }
private dfMarkupStyle applyStyleAttributes(dfMarkupStyle style) { string[] names = new string[] { "valign" }; dfMarkupAttribute attribute = base.findAttribute(names); if (attribute != null) { style.VerticalAlign = dfMarkupStyle.ParseVerticalAlignment(attribute.Value); } string[] textArray2 = new string[] { "color" }; dfMarkupAttribute attribute2 = base.findAttribute(textArray2); if (attribute2 != null) { Color color = dfMarkupStyle.ParseColor(attribute2.Value, (Color)base.Owner.Color); color.a = style.Opacity; style.Color = color; } return(style); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { dfMarkupBorders dfMarkupBorder = new dfMarkupBorders(); dfMarkupStyle _dfMarkupStyle = this.applyDefaultStyles(style, ref dfMarkupBorder); _dfMarkupStyle = base.applyTextStyleAttributes(_dfMarkupStyle); dfMarkupAttribute _dfMarkupAttribute = base.findAttribute(new string[] { "margin" }); if (_dfMarkupAttribute != null) { dfMarkupBorder = dfMarkupBorders.Parse(_dfMarkupAttribute.Value); } dfMarkupBox _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.block, _dfMarkupStyle) { Margins = dfMarkupBorder }; container.AddChild(_dfMarkupBox); base._PerformLayoutImpl(_dfMarkupBox, _dfMarkupStyle); _dfMarkupBox.FitToContents(false); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { style = base.applyTextStyleAttributes(style); style.PreserveWhitespace = true; style.Preformatted = true; if (style.Align == dfMarkupTextAlign.Justify) { style.Align = dfMarkupTextAlign.Left; } dfMarkupBox box = null; if (style.BackgroundColor.a > 0.1f) { dfMarkupBoxSprite sprite = new dfMarkupBoxSprite(this, dfMarkupDisplayType.block, style); sprite.LoadImage(base.Owner.Atlas, base.Owner.BlankTextureSprite); sprite.Style.Color = style.BackgroundColor; box = sprite; } else { box = new dfMarkupBox(this, dfMarkupDisplayType.block, style); } string[] names = new string[] { "margin" }; dfMarkupAttribute attribute = base.findAttribute(names); if (attribute != null) { box.Margins = dfMarkupBorders.Parse(attribute.Value); } string[] textArray2 = new string[] { "padding" }; dfMarkupAttribute attribute2 = base.findAttribute(textArray2); if (attribute2 != null) { box.Padding = dfMarkupBorders.Parse(attribute2.Value); } container.AddChild(box); base._PerformLayoutImpl(box, style); box.FitToContents(false); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { dfMarkupBorders margins = new dfMarkupBorders(); dfMarkupStyle style2 = this.applyDefaultStyles(style, ref margins); style2 = base.applyTextStyleAttributes(style2); string[] names = new string[] { "margin" }; dfMarkupAttribute attribute = base.findAttribute(names); if (attribute != null) { margins = dfMarkupBorders.Parse(attribute.Value); } dfMarkupBox box = new dfMarkupBox(this, dfMarkupDisplayType.block, style2) { Margins = margins }; container.AddChild(box); base._PerformLayoutImpl(box, style2); box.FitToContents(false); }
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style) { string[] names = new string[] { "name", "face" }; dfMarkupAttribute attribute = base.findAttribute(names); if (attribute != null) { dfDynamicFont font1 = dfDynamicFont.FindByName(attribute.Value); if (font1 == null) { } style.Font = style.Font; } string[] textArray2 = new string[] { "size", "font-size" }; dfMarkupAttribute attribute2 = base.findAttribute(textArray2); if (attribute2 != null) { style.FontSize = dfMarkupStyle.ParseSize(attribute2.Value, style.FontSize); } string[] textArray3 = new string[] { "color" }; dfMarkupAttribute attribute3 = base.findAttribute(textArray3); if (attribute3 != null) { style.Color = dfMarkupStyle.ParseColor(attribute3.Value, Color.red); style.Color.a = style.Opacity; } string[] textArray4 = new string[] { "style" }; dfMarkupAttribute attribute4 = base.findAttribute(textArray4); if (attribute4 != null) { style.FontStyle = dfMarkupStyle.ParseFontStyle(attribute4.Value, style.FontStyle); } base._PerformLayoutImpl(container, style); }
protected dfMarkupStyle applyTextStyleAttributes(dfMarkupStyle style) { string[] names = new string[] { "font", "font-family" }; dfMarkupAttribute attribute = this.findAttribute(names); if (attribute != null) { style.Font = dfDynamicFont.FindByName(attribute.Value); } string[] textArray2 = new string[] { "style", "font-style" }; dfMarkupAttribute attribute2 = this.findAttribute(textArray2); if (attribute2 != null) { style.FontStyle = dfMarkupStyle.ParseFontStyle(attribute2.Value, style.FontStyle); } string[] textArray3 = new string[] { "size", "font-size" }; dfMarkupAttribute attribute3 = this.findAttribute(textArray3); if (attribute3 != null) { style.FontSize = dfMarkupStyle.ParseSize(attribute3.Value, style.FontSize); } string[] textArray4 = new string[] { "color" }; dfMarkupAttribute attribute4 = this.findAttribute(textArray4); if (attribute4 != null) { Color color = dfMarkupStyle.ParseColor(attribute4.Value, style.Color); color.a = style.Opacity; style.Color = color; } string[] textArray5 = new string[] { "align", "text-align" }; dfMarkupAttribute attribute5 = this.findAttribute(textArray5); if (attribute5 != null) { style.Align = dfMarkupStyle.ParseTextAlignment(attribute5.Value); } string[] textArray6 = new string[] { "valign", "vertical-align" }; dfMarkupAttribute attribute6 = this.findAttribute(textArray6); if (attribute6 != null) { style.VerticalAlign = dfMarkupStyle.ParseVerticalAlignment(attribute6.Value); } string[] textArray7 = new string[] { "line-height" }; dfMarkupAttribute attribute7 = this.findAttribute(textArray7); if (attribute7 != null) { style.LineHeight = dfMarkupStyle.ParseSize(attribute7.Value, style.LineHeight); } string[] textArray8 = new string[] { "text-decoration" }; dfMarkupAttribute attribute8 = this.findAttribute(textArray8); if (attribute8 != null) { style.TextDecoration = dfMarkupStyle.ParseTextDecoration(attribute8.Value); } string[] textArray9 = new string[] { "background", "background-color" }; dfMarkupAttribute attribute9 = this.findAttribute(textArray9); if (attribute9 != null) { style.BackgroundColor = dfMarkupStyle.ParseColor(attribute9.Value, Color.clear); style.BackgroundColor.a = style.Opacity; } return(style); }
protected dfMarkupStyle applyTextStyleAttributes(dfMarkupStyle style) { dfMarkupAttribute _dfMarkupAttribute = this.findAttribute(new string[] { "font", "font-family" }); if (_dfMarkupAttribute != null) { style.Font = dfDynamicFont.FindByName(_dfMarkupAttribute.Value); } dfMarkupAttribute _dfMarkupAttribute1 = this.findAttribute(new string[] { "style", "font-style" }); if (_dfMarkupAttribute1 != null) { style.FontStyle = dfMarkupStyle.ParseFontStyle(_dfMarkupAttribute1.Value, style.FontStyle); } dfMarkupAttribute _dfMarkupAttribute2 = this.findAttribute(new string[] { "size", "font-size" }); if (_dfMarkupAttribute2 != null) { style.FontSize = dfMarkupStyle.ParseSize(_dfMarkupAttribute2.Value, style.FontSize); } dfMarkupAttribute _dfMarkupAttribute3 = this.findAttribute(new string[] { "color" }); if (_dfMarkupAttribute3 != null) { Color opacity = dfMarkupStyle.ParseColor(_dfMarkupAttribute3.Value, style.Color); opacity.a = style.Opacity; style.Color = opacity; } dfMarkupAttribute _dfMarkupAttribute4 = this.findAttribute(new string[] { "align", "text-align" }); if (_dfMarkupAttribute4 != null) { style.Align = dfMarkupStyle.ParseTextAlignment(_dfMarkupAttribute4.Value); } dfMarkupAttribute _dfMarkupAttribute5 = this.findAttribute(new string[] { "valign", "vertical-align" }); if (_dfMarkupAttribute5 != null) { style.VerticalAlign = dfMarkupStyle.ParseVerticalAlignment(_dfMarkupAttribute5.Value); } dfMarkupAttribute _dfMarkupAttribute6 = this.findAttribute(new string[] { "line-height" }); if (_dfMarkupAttribute6 != null) { style.LineHeight = dfMarkupStyle.ParseSize(_dfMarkupAttribute6.Value, style.LineHeight); } dfMarkupAttribute _dfMarkupAttribute7 = this.findAttribute(new string[] { "text-decoration" }); if (_dfMarkupAttribute7 != null) { style.TextDecoration = dfMarkupStyle.ParseTextDecoration(_dfMarkupAttribute7.Value); } dfMarkupAttribute _dfMarkupAttribute8 = this.findAttribute(new string[] { "background", "background-color" }); if (_dfMarkupAttribute8 != null) { style.BackgroundColor = dfMarkupStyle.ParseColor(_dfMarkupAttribute8.Value, Color.clear); style.BackgroundColor.a = style.Opacity; } return(style); }