本文整理匯總了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;
}