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); } } }
public dfMarkupBox(dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style) { this.Element = element; this.Display = display; this.Style = style; this.Baseline = style.FontSize; }
private dfMarkupElement parseElement(Queue <dfMarkupElement> tokens) { dfMarkupElement element = tokens.Dequeue(); if (element is dfMarkupString) { return(((dfMarkupString)element).SplitWords()); } dfMarkupTag original = (dfMarkupTag)element; if (!original.IsClosedTag && !original.IsEndTag) { while (tokens.Count > 0) { dfMarkupElement node = this.parseElement(tokens); if (node is dfMarkupTag) { dfMarkupTag tag2 = (dfMarkupTag)node; if (tag2.IsEndTag) { if (tag2.TagName == original.TagName) { break; } return(this.refineTag(original)); } } original.AddChildNode(node); } } return(this.refineTag(original)); }
private dfMarkupElement parseElement(Queue <dfMarkupElement> tokens) { dfMarkupElement _dfMarkupElement = tokens.Dequeue(); if (_dfMarkupElement is dfMarkupString) { return(((dfMarkupString)_dfMarkupElement).SplitWords()); } dfMarkupTag _dfMarkupTag = (dfMarkupTag)_dfMarkupElement; if (_dfMarkupTag.IsClosedTag || _dfMarkupTag.IsEndTag) { return(this.refineTag(_dfMarkupTag)); } while (tokens.Count > 0) { dfMarkupElement _dfMarkupElement1 = this.parseElement(tokens); if (_dfMarkupElement1 is dfMarkupTag) { dfMarkupTag _dfMarkupTag1 = (dfMarkupTag)_dfMarkupElement1; if (_dfMarkupTag1.IsEndTag) { if (_dfMarkupTag1.TagName != _dfMarkupTag.TagName) { return(this.refineTag(_dfMarkupTag)); } break; } } _dfMarkupTag.AddChildNode(_dfMarkupElement1); } return(this.refineTag(_dfMarkupTag)); }
public dfMarkupBox(dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style) { this.Position = Vector2.zero; this.Size = Vector2.zero; this.Margins = new dfMarkupBorders(0, 0, 0, 0); this.Padding = new dfMarkupBorders(0, 0, 0, 0); this.children = new System.Collections.Generic.List <dfMarkupBox>(); this.Element = element; this.Display = display; this.Style = style; this.Baseline = style.FontSize; }
public dfMarkupTag(dfMarkupTag original) { this.TagName = original.TagName; this.Attributes = original.Attributes; this.IsEndTag = original.IsEndTag; this.IsClosedTag = original.IsClosedTag; this.IsInline = original.IsInline; this.id = original.id; System.Collections.Generic.List <dfMarkupElement> childNodes = original.ChildNodes; for (int i = 0; i < childNodes.Count; i++) { dfMarkupElement node = childNodes[i]; base.AddChildNode(node); } }
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(); } } }
private dfMarkupTag hitTestTag(dfMouseEventArgs args) { Vector2 point = base.GetHitPosition(args) + this.scrollPosition; dfMarkupBox box = this.viewportBox.HitTest(point); if (box == null) { return(null); } dfMarkupElement parent = box.Element; while ((parent != null) && !(parent is dfMarkupTag)) { parent = parent.Parent; } return(parent as dfMarkupTag); }
public static dfMarkupBoxText Obtain(dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style) { if (dfMarkupBoxText.objectPool.Count <= 0) { return new dfMarkupBoxText(element, display, style); } dfMarkupBoxText fontSize = dfMarkupBoxText.objectPool.Dequeue(); fontSize.Element = element; fontSize.Display = display; fontSize.Style = style; fontSize.Position = Vector2.zero; fontSize.Size = Vector2.zero; fontSize.Baseline = (int)((float)style.FontSize * 1.1f); fontSize.Margins = new dfMarkupBorders(); fontSize.Padding = new dfMarkupBorders(); return fontSize; }
public static dfMarkupBoxText Obtain(dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style) { if (objectPool.Count > 0) { dfMarkupBoxText text = objectPool.Dequeue(); text.Element = element; text.Display = display; text.Style = style; text.Position = Vector2.zero; text.Size = Vector2.zero; text.Baseline = (int)(style.FontSize * 1.1f); text.Margins = new dfMarkupBorders(); text.Padding = new dfMarkupBorders(); return(text); } return(new dfMarkupBoxText(element, display, style)); }
private dfMarkupTag hitTestTag(dfMouseEventArgs args) { Vector2 hitPosition = base.GetHitPosition(args) + this.scrollPosition; dfMarkupBox _dfMarkupBox = this.viewportBox.HitTest(hitPosition); if (_dfMarkupBox == null) { return(null); } dfMarkupElement element = _dfMarkupBox.Element; while (element != null && !(element is dfMarkupTag)) { element = element.Parent; } return(element as dfMarkupTag); }
public static dfMarkupBoxText Obtain(dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style) { if (dfMarkupBoxText.objectPool.Count <= 0) { return(new dfMarkupBoxText(element, display, style)); } dfMarkupBoxText fontSize = dfMarkupBoxText.objectPool.Dequeue(); fontSize.Element = element; fontSize.Display = display; fontSize.Style = style; fontSize.Position = Vector2.zero; fontSize.Size = Vector2.zero; fontSize.Baseline = (int)((float)style.FontSize * 1.1f); fontSize.Margins = new dfMarkupBorders(); fontSize.Padding = new dfMarkupBorders(); return(fontSize); }
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); } }
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); } } }
public void AddChildNode(dfMarkupElement node) { node.Parent = this; ChildNodes.Add(node); }
public void AddChildNode( dfMarkupElement node ) { node.Parent = this; ChildNodes.Add( node ); }
public static dfMarkupBoxText Obtain( dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style ) { if( objectPool.Count > 0 ) { var instance = objectPool.Dequeue(); instance.Element = element; instance.Display = display; instance.Style = style; instance.Position = Vector2.zero; instance.Size = Vector2.zero; instance.Baseline = (int)( style.FontSize * 1.1f ); instance.Margins = new dfMarkupBorders(); instance.Padding = new dfMarkupBorders(); return instance; } return new dfMarkupBoxText( element, display, style ); }
public dfMarkupBoxText( dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style ) : base( element, display, style ) { }
public dfMarkupBoxTexture(dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style) : base(element, display, style) { this.renderData = new dfRenderData(0x20); }
public dfMarkupBoxSprite(dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style) : base(element, display, style) { }
internal virtual void Release() { this.Parent = null; this.ChildNodes.Clear(); }