• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# dfMarkupBox类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中dfMarkupBox的典型用法代码示例。如果您正苦于以下问题:C# dfMarkupBox类的具体用法?C# dfMarkupBox怎么用?C# dfMarkupBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



dfMarkupBox类属于命名空间,在下文中一共展示了dfMarkupBox类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:35,代码来源:dfMarkupTagPre.cs


示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:25,代码来源:dfMarkupTagFont.cs


示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:13,代码来源:dfMarkupTagBold.cs


示例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();
         }
     }
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:16,代码来源:dfMarkupTagSpan.cs


示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:46,代码来源:dfMarkupTagImg.cs


示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:44,代码来源:dfMarkupTagListItem.cs


示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:42,代码来源:dfMarkupTagParagraph.cs


示例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);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:20,代码来源:dfMarkupTagList.cs


示例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 );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:56,代码来源:dfMarkupTags.cs


示例10: _PerformLayoutImpl

 protected abstract void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style );
开发者ID:dashqasar,项目名称:GoogleMap,代码行数:1,代码来源:dfMarkupElement.cs


示例11: PerformLayout

 public void PerformLayout(dfMarkupBox container, dfMarkupStyle style)
 {
     this._PerformLayoutImpl(container, style);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:4,代码来源:dfMarkupElement.cs


示例12: PerformLayout

 public void PerformLayout( dfMarkupBox container, dfMarkupStyle style )
 {
     Profiler.BeginSample( "Perform markup layout: " + this.GetType().Name );
     _PerformLayoutImpl( container, style );
     Profiler.EndSample();
 }
开发者ID:dashqasar,项目名称:GoogleMap,代码行数:6,代码来源:dfMarkupElement.cs


示例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 );
    }
开发者ID:BjarkeHou,项目名称:ProjectGuard,代码行数:14,代码来源:dfMarkupBox.cs


示例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 );
    }
开发者ID:BjarkeHou,项目名称:ProjectGuard,代码行数:21,代码来源:dfMarkupBox.cs


示例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 );
    }
开发者ID:BjarkeHou,项目名称:ProjectGuard,代码行数:25,代码来源:dfMarkupBox.cs


示例16: addInline

    private void addInline( dfMarkupBox box )
    {
        var margin = box.Margins;

        bool needsWordwrap =
            !Style.Preformatted &&
            ( currentLine != null && currentLinePos + box.Size.x > currentLine.Size.x );

        if( currentLine == null || needsWordwrap )
        {

            endCurrentLine();

            var lineOffsetTop = getVerticalPosition( margin.top );

            var block = GetContainingBlock();
            if( block == null )
            {
                Debug.LogError( "Containing block not found" );
                return;
            }

            var font = Style.Font ?? Style.Host.Font;
            var multiplier = (float)font.FontSize / (float)font.FontSize;
            var lineBaseline = font.Baseline * multiplier;

            currentLine = new dfMarkupBox( this.Element, dfMarkupDisplayType.block, this.Style )
            {
                Size = new Vector2( block.Size.x, Style.LineHeight ),
                Position = new Vector2( 0, lineOffsetTop ),
                Parent = this,
                Baseline = (int)lineBaseline
            };

            children.Add( currentLine );

        }

        // Eliminate whitespace at beginning of the line, if whitespace is not preserved
        if( currentLinePos == 0 && !box.Style.PreserveWhitespace && box is dfMarkupBoxText )
        {
            var text = box as dfMarkupBoxText;
            if( text.IsWhitespace )
            {
                return;
            }
        }

        var boxPosition = new Vector2( currentLinePos + margin.left, margin.top );
        box.Position = boxPosition;

        box.Parent = currentLine;
        currentLine.children.Add( box );

        currentLinePos = (int)( boxPosition.x + box.Size.x + box.Margins.right );

        var lineWidth = Mathf.Max( currentLine.Size.x, boxPosition.x + box.Size.x );
        var lineHeight = Mathf.Max( currentLine.Size.y, boxPosition.y + box.Size.y );

        currentLine.Size = new Vector2( lineWidth, lineHeight );
    }
开发者ID:BjarkeHou,项目名称:ProjectGuard,代码行数:61,代码来源:dfMarkupBox.cs


示例17: gatherRenderBuffers

    private void gatherRenderBuffers( dfMarkupBox box, dfList<dfRenderData> buffers )
    {
        var intersectionType = getViewportIntersection( box );
        if( intersectionType == dfIntersectionType.None )
        {
            return;
        }

        var buffer = box.Render();
        if( buffer != null )
        {

            if( buffer.Material == null )
            {
                if( this.atlas != null )
                {
                    buffer.Material = atlas.Material;
                }
            }

            var p2u = PixelsToUnits();
            var scroll = -scrollPosition.Scale( 1, -1 ).RoundToInt();
            var offset = (Vector3)( scroll + box.GetOffset().Scale( 1, -1 ) ) + pivot.TransformToUpperLeft( Size );

            var vertices = buffer.Vertices;
            for( int i = 0; i < buffer.Vertices.Count; i++ )
            {
                vertices[ i ] = ( offset + vertices[ i ] ) * p2u;
            }

            if( intersectionType == dfIntersectionType.Intersecting )
            {
                clipToViewport( buffer );
            }

            buffer.Transform = transform.localToWorldMatrix;
            buffers.Add( buffer );

        }

        for( int i = 0; i < box.Children.Count; i++ )
        {
            gatherRenderBuffers( box.Children[ i ], buffers );
        }
    }
开发者ID:kvelury,项目名称:apocalyptia,代码行数:45,代码来源:dfRichTextLabel.cs


示例18: getViewportIntersection

    private dfIntersectionType getViewportIntersection( dfMarkupBox box )
    {
        if( box.Display == dfMarkupDisplayType.none )
            return dfIntersectionType.None;

        var viewSize = this.Size;
        var min = box.GetOffset() - scrollPosition;
        var max = min + box.Size;

        if( max.x <= 0 || max.y <= 0 )
            return dfIntersectionType.None;

        if( min.x >= viewSize.x || min.y >= viewSize.y )
            return dfIntersectionType.None;

        if( min.x < 0 || min.y < 0 || max.x > viewSize.x || max.y > viewSize.y )
            return dfIntersectionType.Intersecting;

        return dfIntersectionType.Inside;
    }
开发者ID:kvelury,项目名称:apocalyptia,代码行数:20,代码来源:dfRichTextLabel.cs


示例19: processMarkup

    private void processMarkup()
    {
        releaseMarkupReferences();

        this.elements = dfMarkupParser.Parse( this, this.text );

        var scaleMultiplier = getTextScaleMultiplier();

        var scaledFontSize = Mathf.CeilToInt( this.FontSize * scaleMultiplier );
        var scaledLineHeight = Mathf.CeilToInt( this.LineHeight * scaleMultiplier );

        var style = new dfMarkupStyle()
        {
            Host = this,
            Atlas = this.Atlas,
            Font = this.Font,
            FontSize = scaledFontSize,
            FontStyle = this.FontStyle,
            LineHeight = scaledLineHeight,
            Color = ApplyOpacity( this.Color ),
            Opacity = this.CalculateOpacity(),
            Align = this.TextAlignment,
            PreserveWhitespace = this.preserveWhitespace
        };

        viewportBox = new dfMarkupBox( null, dfMarkupDisplayType.block, style )
        {
            Size = this.Size
        };

        //@Profiler.BeginSample( "Perform layout on markup" );
        for( int i = 0; i < elements.Count; i++ )
        {
            var child = elements[ i ];
            if( child != null )
            {
                child.PerformLayout( viewportBox, style );
            }
        }
        Profiler.EndSample();
    }
开发者ID:kvelury,项目名称:apocalyptia,代码行数:41,代码来源:dfRichTextLabel.cs



注:本文中的dfMarkupBox类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# dfMarkupStyle类代码示例发布时间:2022-05-24
下一篇:
C# dfKeyEventArgs类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap