当前位置: 首页>>代码示例>>C#>>正文


C# XmlElement.AttributeInt方法代码示例

本文整理汇总了C#中System.Xml.XmlElement.AttributeInt方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElement.AttributeInt方法的具体用法?C# XmlElement.AttributeInt怎么用?C# XmlElement.AttributeInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlElement的用法示例。


在下文中一共展示了XmlElement.AttributeInt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TiledTileLayer

        public TiledTileLayer(XmlElement xLayer) : base(xLayer)
        {
            Width = xLayer.AttributeInt("width");
            Height = xLayer.AttributeInt("height");
            Encoding = xLayer["data"].Attributes["encoding"].Value;

            if(xLayer.Attributes["opacity"] != null)
            {
                Opacity = xLayer.AttributeFloat("opacity");
            }
            
            DecodeTiles(xLayer);
        }
开发者ID:holymoo,项目名称:Otter.TiledLoader,代码行数:13,代码来源:TiledTileLayer.cs

示例2: SetTile

 /// <summary>
 /// Load tile data from an XmlElement.
 /// </summary>
 /// <param name="e">An XmlElement containing attributes x, y, tx, and ty.</param>
 /// <returns>The TileInfo for the loaded tile.</returns>
 public TileInfo SetTile(XmlElement e) {
     int x, y, tx, ty;
     if (UsePositions) {
         x = e.AttributeInt("x") * TileWidth;
         y = e.AttributeInt("y") * TileHeight;
     }
     else {
         x = e.AttributeInt("x");
         y = e.AttributeInt("y");
     }
     tx = e.AttributeInt("tx") * TileWidth;
     ty = e.AttributeInt("ty") * TileHeight;
     return SetTile(x, y, tx, ty);
 }
开发者ID:KrissLaCross,项目名称:BreakOut,代码行数:19,代码来源:Tilemap.cs

示例3: CreateEntity

        void CreateEntity(XmlElement e, Scene scene) {
            Type entityType = Util.GetTypeFromAllAssemblies(e.Name);

            object[] arguments = new object[2];
            arguments[0] = scene;
            arguments[1] = e.Attributes;

            if (entityType != null) {
                MethodInfo method = entityType.GetMethod(CreationMethodName, BindingFlags.Static | BindingFlags.Public);
                if (method != null) {
                    method.Invoke(null, arguments);
                }
                else {
                    // Attempt to create with just constructor
                    var x = e.AttributeInt("x");
                    var y = e.AttributeInt("y");
                    var entity = (Entity)Activator.CreateInstance(entityType, x, y);
                    scene.Add(entity);
                }
            }
        }
开发者ID:NeroInu,项目名称:TragicMagicOtter,代码行数:21,代码来源:OgmoProject.cs

示例4: TiledTileset

 public TiledTileset(XmlElement xTileset)
 {
     Name = xTileset.Attributes["name"].Value;
     FirstGid = xTileset.AttributeInt("firstgid");
     ImageSource = xTileset["image"].Attributes["source"].Value;
 }
开发者ID:holymoo,项目名称:Otter.TiledLoader,代码行数:6,代码来源:TiledTileset.cs


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