本文整理汇总了C#中System.Xml.XmlAttributeCollection.Int方法的典型用法代码示例。如果您正苦于以下问题:C# XmlAttributeCollection.Int方法的具体用法?C# XmlAttributeCollection.Int怎么用?C# XmlAttributeCollection.Int使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlAttributeCollection
的用法示例。
在下文中一共展示了XmlAttributeCollection.Int方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFromXML
public static void CreateFromXML(Scene scene, XmlAttributeCollection attributes)
{
Brick brick = new Brick();
brick.SetPosition(attributes.Int("x", 0), attributes.Int("y", 0));
brick.Graphic = new Image("Assets/Images/grasses.png", new Rectangle(256, 0, Global.GridSize, Global.GridSize));
scene.Add(brick);
}
示例2: CreateFromXML
public static void CreateFromXML(Scene scene, XmlAttributeCollection attributes)
{
int playerNumber = attributes.Int("player", 0);
Session playerSession;
Color color = Color.None;
if (playerNumber == 0)
{
playerSession = Global.PlayerOneSession;
color = Color.White;
}
else if (playerNumber == 1)
{
playerSession = Global.PlayerTwoSession;
color = Color.Yellow;
}
else if (playerNumber == 2)
{
playerSession = Global.PlayerThreeSession;
color = Color.Blue;
}
else
{
playerSession = Global.PlayerFourSession;
color = Color.Grey;
}
Bomberman player = new Bomberman(playerSession, color);
player.SetPosition(attributes.Int("x", 0), attributes.Int("y", 0));
scene.Add(player);
}
示例3: MyCreateEntity
/// <summary>
/// This function gets called by the ogmo level loader
/// </summary>
public static void MyCreateEntity(Scene scene, XmlAttributeCollection ogmoParameters)
{
//ok ogmo gives us the position in x and y, and the list of decorators in DecoratorList
int x = ogmoParameters.Int("x", -1);
int y = ogmoParameters.Int("y", -1);
//this is how you read a string from ogmo
string decoList = ogmoParameters.GetNamedItem("DecoratorList").Value;
//create an instance
Tank t = new Tank(x, y);
//try and load an id; if there is none, the id will be -1
t.NetworkId = ogmoParameters.Int("NetworkId", -1);
//add to the scene because the decorators need that
scene.Add(t);
//split the decorators; they are seperated by a ":" in the DecoratorList string
string[] decoArray = decoList.Split(':');
//add each decorator
foreach (string decoratorName in decoArray)
{
//parse the name of the decorator to the decorator-enum, and then add to the tank
t.AddDecorator((Decorators) Enum.Parse(typeof(Decorators), decoratorName));
}
}