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

C# dfMarkupStyle类代码示例

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

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



dfMarkupStyle类属于命名空间,在下文中一共展示了dfMarkupStyle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: dfMarkupBox

 public dfMarkupBox(dfMarkupElement element, dfMarkupDisplayType display, dfMarkupStyle style)
 {
     this.Element = element;
     this.Display = display;
     this.Style = style;
     this.Baseline = style.FontSize;
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:7,代码来源:dfMarkupBox.cs


示例2: _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


示例3: _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


示例4: _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


示例5: _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


示例6: applyStyleAttributes

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


示例7: Obtain

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


示例8: _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


示例9: _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


示例10: _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


示例11: _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


示例12: calculateBulletWidth

 private void calculateBulletWidth(dfMarkupStyle style)
 {
     if (base.TagName == "ul")
     {
         Vector2 vector2 = style.Font.MeasureText("•", style.FontSize, style.FontStyle);
         this.BulletWidth = Mathf.CeilToInt(vector2.x);
         return;
     }
     int num = 0;
     for (int i = 0; i < base.ChildNodes.Count; i++)
     {
         dfMarkupTag item = base.ChildNodes[i] as dfMarkupTag;
         if (item != null && item.TagName == "li")
         {
             num++;
         }
     }
     string str = string.Concat(new string('X', num.ToString().Length), ".");
     Vector2 vector21 = style.Font.MeasureText(str, style.FontSize, style.FontStyle);
     this.BulletWidth = Mathf.CeilToInt(vector21.x);
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:21,代码来源:dfMarkupTagList.cs


示例13: applyDefaultStyles

    private dfMarkupStyle applyDefaultStyles( dfMarkupStyle style, ref dfMarkupBorders margins )
    {
        // http://www.w3.org/TR/CSS21/sample.html

        var marginSize = 1f;
        var fontSize = 1f;

        switch( TagName )
        {
            case "h1":
                fontSize = 2f;
                marginSize = 0.65f;
                break;
            case "h2":
                fontSize = 1.5f;
                marginSize = 0.75f;
                break;
            case "h3":
                fontSize = 1.35f;
                marginSize = 0.85f;
                break;
            case "h4":
                fontSize = 1.15f;
                marginSize = 0;
                break;
            case "h5":
                fontSize = 0.85f;
                marginSize = 1.5f;
                break;
            case "h6":
                fontSize = 0.75f;
                marginSize = 1.75f;
                break;
        }

        style.FontSize = (int)( style.FontSize * fontSize );
        style.FontStyle = FontStyle.Bold;
        style.Align = dfMarkupTextAlign.Left;

        marginSize *= style.FontSize;
        margins.top = margins.bottom = (int)marginSize;

        return style;
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:44,代码来源:dfMarkupTags.cs


示例14: _PerformLayoutImpl

    protected override void _PerformLayoutImpl( dfMarkupBox container, dfMarkupStyle style )
    {
        var headingMargins = new dfMarkupBorders();

        var headingStyle = applyDefaultStyles( style, ref headingMargins );
        headingStyle = applyTextStyleAttributes( headingStyle );

        // Allow overriding of margins
        var marginAttribute = findAttribute( "margin" );
        if( marginAttribute != null )
        {
            headingMargins = dfMarkupBorders.Parse( marginAttribute.Value );
        }

        var headingBox = new dfMarkupBox( this, dfMarkupDisplayType.block, headingStyle );
        headingBox.Margins = headingMargins;

        container.AddChild( headingBox );

        base._PerformLayoutImpl( headingBox, headingStyle );
        headingBox.FitToContents();
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:22,代码来源:dfMarkupTags.cs


示例15: calculateBulletWidth

    private void calculateBulletWidth( dfMarkupStyle style )
    {
        if( this.TagName == "ul" )
        {

            var measuredBullet = style.Font.MeasureText( "•", style.FontSize, style.FontStyle );

            BulletWidth = Mathf.CeilToInt( measuredBullet.x );

            return;

        }

        var itemCount = 0;
        for( int i = 0; i < ChildNodes.Count; i++ )
        {

            var child = ChildNodes[ i ] as dfMarkupTag;
            if( child != null && child.TagName == "li" )
            {
                itemCount += 1;
            }

        }

        var numberText = new string( 'X', itemCount.ToString().Length ) + ".";
        var measuredNumber = style.Font.MeasureText( numberText, style.FontSize, style.FontStyle );

        BulletWidth = Mathf.CeilToInt( measuredNumber.x );
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:30,代码来源:dfMarkupTags.cs


示例16: createImageBox

    private dfMarkupBox createImageBox( dfAtlas atlas, string source, dfMarkupStyle style )
    {
        if( source.ToLowerInvariant().StartsWith( "http://" ) )
        {
            return null;
        }
        else if( atlas != null && atlas[ source ] != null )
        {

            var spriteBox = new dfMarkupBoxSprite( this, dfMarkupDisplayType.inline, style );
            spriteBox.LoadImage( atlas, source );

            return spriteBox;

        }
        else
        {
            var texture = dfMarkupImageCache.Load( source );
            if( texture != null )
            {

                var textureBox = new dfMarkupBoxTexture( this, dfMarkupDisplayType.inline, style );
                textureBox.LoadTexture( texture );

                return textureBox;

            }
        }

        return null;
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:31,代码来源:dfMarkupTags.cs


示例17: applyStyleAttributes

    private dfMarkupStyle applyStyleAttributes( dfMarkupStyle style )
    {
        var alignAttribute = findAttribute( "valign" );
        if( alignAttribute != null )
        {
            style.VerticalAlign = dfMarkupStyle.ParseVerticalAlignment( alignAttribute.Value );
        }

        var fontColorAttribute = findAttribute( "color" );
        if( fontColorAttribute != null )
        {
            var color = dfMarkupStyle.ParseColor( fontColorAttribute.Value, Owner.Color );
            color.a = style.Opacity;
            style.Color = color;
        }

        return style;
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:18,代码来源:dfMarkupTags.cs


示例18: 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


示例19: _PerformLayoutImpl

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


示例20: applyTextStyleAttributes

    protected dfMarkupStyle applyTextStyleAttributes( dfMarkupStyle style )
    {
        var fontAttribute = findAttribute( "font", "font-family" );
        if( fontAttribute != null )
        {
            style.Font = dfDynamicFont.FindByName( fontAttribute.Value ) ?? owner.Font;
        }

        var fontStyleAttribute = findAttribute( "style", "font-style" );
        if( fontStyleAttribute != null )
        {
            style.FontStyle = dfMarkupStyle.ParseFontStyle( fontStyleAttribute.Value, style.FontStyle );
        }

        var sizeAttribute = findAttribute( "size", "font-size" );
        if( sizeAttribute != null )
        {
            style.FontSize = dfMarkupStyle.ParseSize( sizeAttribute.Value, style.FontSize );
        }

        var colorAttribute = findAttribute( "color" );
        if( colorAttribute != null )
        {
            var color = dfMarkupStyle.ParseColor( colorAttribute.Value, style.Color );
            color.a = style.Opacity;
            style.Color = color;
        }

        var alignAttribute = findAttribute( "align", "text-align" );
        if( alignAttribute != null )
        {
            style.Align = dfMarkupStyle.ParseTextAlignment( alignAttribute.Value );
        }

        var vertAlignAttribute = findAttribute( "valign", "vertical-align" );
        if( vertAlignAttribute != null )
        {
            style.VerticalAlign = dfMarkupStyle.ParseVerticalAlignment( vertAlignAttribute.Value );
        }

        var lineHeightAttribute = findAttribute( "line-height" );
        if( lineHeightAttribute != null )
        {
            style.LineHeight = dfMarkupStyle.ParseSize( lineHeightAttribute.Value, style.LineHeight );
        }

        var textDecorationAttribute = findAttribute( "text-decoration" );
        if( textDecorationAttribute != null )
        {
            style.TextDecoration = dfMarkupStyle.ParseTextDecoration( textDecorationAttribute.Value );
        }

        var backgroundAttribute = findAttribute( "background", "background-color" );
        if( backgroundAttribute != null )
        {
            style.BackgroundColor = dfMarkupStyle.ParseColor( backgroundAttribute.Value, Color.clear );
            style.BackgroundColor.a = style.Opacity;
        }

        return style;
    }
开发者ID:AhrenLi,项目名称:2048,代码行数:61,代码来源:dfMarkupTags.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# dfMouseEventArgs类代码示例发布时间:2022-05-24
下一篇:
C# dfMarkupBox类代码示例发布时间: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