本文整理汇总了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);
}
示例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);
}
示例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);
}
}
}
示例4: TiledTileset
public TiledTileset(XmlElement xTileset)
{
Name = xTileset.Attributes["name"].Value;
FirstGid = xTileset.AttributeInt("firstgid");
ImageSource = xTileset["image"].Attributes["source"].Value;
}