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