本文整理汇总了C#中dfMarkupBox.AddChild方法的典型用法代码示例。如果您正苦于以下问题:C# dfMarkupBox.AddChild方法的具体用法?C# dfMarkupBox.AddChild怎么用?C# dfMarkupBox.AddChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dfMarkupBox
的用法示例。
在下文中一共展示了dfMarkupBox.AddChild方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _PerformLayoutImpl
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 _dfMarkupBox = null;
if (style.BackgroundColor.a <= 0.1f)
{
_dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.block, style);
}
else
{
dfMarkupBoxSprite _dfMarkupBoxSprite = new dfMarkupBoxSprite(this, dfMarkupDisplayType.block, style);
_dfMarkupBoxSprite.LoadImage(base.Owner.Atlas, base.Owner.BlankTextureSprite);
_dfMarkupBoxSprite.Style.Color = style.BackgroundColor;
_dfMarkupBox = _dfMarkupBoxSprite;
}
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);
_dfMarkupBox.FitToContents(false);
}
示例2: _PerformLayoutImpl
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
{
if (base.ChildNodes.Count == 0)
{
return;
}
float size = container.Size.x;
dfMarkupBox _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.listItem, style);
_dfMarkupBox.Margins.top = 10;
container.AddChild(_dfMarkupBox);
dfMarkupTagList parent = base.Parent as dfMarkupTagList;
if (parent == null)
{
base._PerformLayoutImpl(container, style);
return;
}
style.VerticalAlign = dfMarkupVerticalAlign.Baseline;
string str = "•";
if (parent.TagName == "ol")
{
str = string.Concat(container.Children.Count, ".");
}
dfMarkupStyle _dfMarkupStyle = style;
_dfMarkupStyle.VerticalAlign = dfMarkupVerticalAlign.Baseline;
_dfMarkupStyle.Align = dfMarkupTextAlign.Right;
dfMarkupBoxText bulletWidth = dfMarkupBoxText.Obtain(this, dfMarkupDisplayType.inlineBlock, _dfMarkupStyle);
bulletWidth.SetText(str);
bulletWidth.Width = parent.BulletWidth;
bulletWidth.Margins.left = style.FontSize * 2;
_dfMarkupBox.AddChild(bulletWidth);
dfMarkupBox vector2 = new dfMarkupBox(this, dfMarkupDisplayType.inlineBlock, style);
int fontSize = style.FontSize;
float single = size - bulletWidth.Size.x - (float)bulletWidth.Margins.left - (float)fontSize;
vector2.Size = new Vector2(single, (float)fontSize);
vector2.Margins.left = (int)((float)style.FontSize * 0.5f);
_dfMarkupBox.AddChild(vector2);
for (int i = 0; i < base.ChildNodes.Count; i++)
{
base.ChildNodes[i].PerformLayout(vector2, style);
}
vector2.FitToContents(false);
vector2.Parent.FitToContents(false);
_dfMarkupBox.FitToContents(false);
}
示例3: _PerformLayoutImpl
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);
}
示例4: _PerformLayoutImpl
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);
}
示例5: _PerformLayoutImpl
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
{
if (base.ChildNodes.Count == 0)
{
return;
}
style.Align = dfMarkupTextAlign.Left;
dfMarkupBox _dfMarkupBox = new dfMarkupBox(this, dfMarkupDisplayType.block, style);
container.AddChild(_dfMarkupBox);
this.calculateBulletWidth(style);
for (int i = 0; i < base.ChildNodes.Count; i++)
{
dfMarkupTag item = base.ChildNodes[i] as dfMarkupTag;
if (item != null && !(item.TagName != "li"))
{
item.PerformLayout(_dfMarkupBox, style);
}
}
_dfMarkupBox.FitToContents(false);
}
示例6: _PerformLayoutImpl
protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style )
{
style = applyTextStyleAttributes( style );
style.PreserveWhitespace = true;
style.Preformatted = true;
if( style.Align == dfMarkupTextAlign.Justify )
{
style.Align = dfMarkupTextAlign.Left;
}
dfMarkupBox paragraphBox = null;
if( style.BackgroundColor.a > 0.1f )
{
var spriteBox = new dfMarkupBoxSprite( this, dfMarkupDisplayType.block, style );
spriteBox.LoadImage( this.Owner.Atlas, this.Owner.BlankTextureSprite );
spriteBox.Style.Color = style.BackgroundColor;
paragraphBox = spriteBox;
}
else
{
paragraphBox = new dfMarkupBox( this, dfMarkupDisplayType.block, style );
}
#region Allow overriding of margins and padding
var marginAttribute = findAttribute( "margin" );
if( marginAttribute != null )
{
paragraphBox.Margins = dfMarkupBorders.Parse( marginAttribute.Value );
}
var paddingAttribute = findAttribute( "padding" );
if( paddingAttribute != null )
{
paragraphBox.Padding = dfMarkupBorders.Parse( paddingAttribute.Value );
}
#endregion
container.AddChild( paragraphBox );
base._PerformLayoutImpl( paragraphBox, style );
paragraphBox.FitToContents();
}
示例7: _PerformLayoutImpl
protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style )
{
if( style.Font == null )
return;
var effectiveText = style.PreserveWhitespace || !isWhitespace ? this.Text : " ";
var box = dfMarkupBoxText.Obtain( this, dfMarkupDisplayType.inline, style );
box.SetText( effectiveText );
container.AddChild( box );
}
示例8: _PerformLayoutImpl
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
{
if (style.Font == null)
{
return;
}
string str = (style.PreserveWhitespace || !this.isWhitespace ? this.Text : " ");
dfMarkupBoxText _dfMarkupBoxText = dfMarkupBoxText.Obtain(this, dfMarkupDisplayType.inline, style);
_dfMarkupBoxText.SetText(str);
container.AddChild(_dfMarkupBoxText);
}