本文整理汇总了C#中dfMarkupBox类的典型用法代码示例。如果您正苦于以下问题:C# dfMarkupBox类的具体用法?C# dfMarkupBox怎么用?C# dfMarkupBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
dfMarkupBox类属于命名空间,在下文中一共展示了dfMarkupBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
{
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);
}
示例3: _PerformLayoutImpl
protected override void _PerformLayoutImpl(dfMarkupBox container, dfMarkupStyle style)
{
style = base.applyTextStyleAttributes(style);
if (style.FontStyle == FontStyle.Normal)
{
style.FontStyle = FontStyle.Bold;
}
else if (style.FontStyle == FontStyle.Italic)
{
style.FontStyle = FontStyle.BoldAndItalic;
}
base._PerformLayoutImpl(container, style);
}
示例4: _PerformLayoutImpl
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();
}
}
}
示例5: _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);
}
示例6: _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);
}
示例7: _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);
}
示例8: _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);
}
示例9: _PerformLayoutImpl
protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style )
{
if( this.ChildNodes.Count == 0 )
return;
style = applyTextStyleAttributes( style );
var topMargin = container.Children.Count == 0 ? 0 : style.LineHeight;
dfMarkupBox paragraphBox = null;
if( style.BackgroundColor.a > 0.005f )
{
var spriteBox = new dfMarkupBoxSprite( this, dfMarkupDisplayType.block, style );
spriteBox.Atlas = this.Owner.Atlas;
spriteBox.Source = this.Owner.BlankTextureSprite;
spriteBox.Style.Color = style.BackgroundColor;
paragraphBox = spriteBox;
}
else
{
paragraphBox = new dfMarkupBox( this, dfMarkupDisplayType.block, style );
}
paragraphBox.Margins = new dfMarkupBorders( 0, 0, topMargin, style.LineHeight );
#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 );
if( paragraphBox.Children.Count > 0 )
{
paragraphBox.Children[ paragraphBox.Children.Count - 1 ].IsNewline = true;
}
paragraphBox.FitToContents( true );
}
示例10: _PerformLayoutImpl
protected abstract void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style );
示例11: PerformLayout
public void PerformLayout(dfMarkupBox container, dfMarkupStyle style)
{
this._PerformLayoutImpl(container, style);
}
示例12: PerformLayout
public void PerformLayout( dfMarkupBox container, dfMarkupStyle style )
{
Profiler.BeginSample( "Perform markup layout: " + this.GetType().Name );
_PerformLayoutImpl( container, style );
Profiler.EndSample();
}
示例13: AddChild
public virtual void AddChild( dfMarkupBox box )
{
var display = box.Display;
var needsBlockLayout =
display == dfMarkupDisplayType.block ||
display == dfMarkupDisplayType.table ||
display == dfMarkupDisplayType.listItem ||
display == dfMarkupDisplayType.tableRow;
if( needsBlockLayout )
addBlock( box );
else
addInline( box );
}
示例14: AddLineBreak
internal void AddLineBreak()
{
if( currentLine != null )
{
currentLine.IsNewline = true;
}
var lineOffsetTop = getVerticalPosition( 0 );
endCurrentLine();
var block = GetContainingBlock();
currentLine = new dfMarkupBox( this.Element, dfMarkupDisplayType.block, this.Style )
{
Size = new Vector2( block.Size.x, Style.FontSize ),
Position = new Vector2( 0, lineOffsetTop ),
Parent = this
};
children.Add( currentLine );
}
示例15: addBlock
private void addBlock( dfMarkupBox box )
{
if( currentLine != null )
{
currentLine.IsNewline = true;
endCurrentLine( true );
}
var container = GetContainingBlock();
// If a block box does not have a size specified, then by default it
// is the width of the containing block
if( box.Size.sqrMagnitude <= float.Epsilon )
{
box.Size = new Vector2( container.Size.x - box.Margins.horizontal, Style.FontSize );
}
var boxTop = getVerticalPosition( box.Margins.top );
box.Position = new Vector2( box.Margins.left, boxTop );
this.Size = new Vector2( this.Size.x, Mathf.Max( this.Size.y, box.Position.y + box.Size.y ) );
box.Parent = this;
children.Add( box );
}