本文整理汇总了C#中Component.addData方法的典型用法代码示例。如果您正苦于以下问题:C# Component.addData方法的具体用法?C# Component.addData怎么用?C# Component.addData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component.addData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadCreatures
public static void LoadCreatures()
{
loadedCreatures = new List<Creature>();
uniqueAttributes = new List<string>();
using (XmlReader reader = XmlReader.Create("Assets/CreatureList.xml"))
{
Component component = new Component(Component.Type.Bell);
Creature currentCreature = new Creature();
reader.ReadToFollowing("Creature");
while (!reader.EOF)
{
reader.Read();
if (reader.NodeType != XmlNodeType.EndElement)
switch (reader.Name)
{
case "Creature":
currentCreature = new Creature();
break;
case "Title":
currentCreature.Title = reader.ReadInnerXml();
break;
case "Type":
currentCreature.Type = reader.ReadInnerXml();
break;
case "Attribute":
string attr = reader.ReadInnerXml();
currentCreature.Attributes.Add(attr);
if (!uniqueAttributes.Contains(attr))
uniqueAttributes.Add(attr);
break;
case "Name":
currentCreature.Names.Add(reader.ReadInnerXml());
break;
case "Bells":
component = new Component(Component.Type.Bell);
break;
case "Bell":
component.addData(byte.Parse(reader.ReadInnerXml()));
break;
case "Effigy":
component = new Component(Component.Type.Effigy);
break;
case "Cut":
component.addData(byte.Parse(reader.ReadInnerXml()));
break;
case "Incantation":
currentCreature.RequiredComponents.Add(new Component(reader.ReadInnerXml().ToUpper()));
break;
case "Potion":
component = new Component(Component.Type.Potion);
break;
case "Material":
component.addData(byte.Parse(reader.ReadInnerXml()));
break;
case "Rune":
component = new Component(Component.Type.Rune);
break;
case "Point":
component.addData(byte.Parse(reader.ReadInnerXml()));
break;
}
else
switch (reader.Name)
{
case "Creature":
loadedCreatures.Add(currentCreature);
break;
case "Bells":
case "Effigy":
case "Potion":
case "Rune":
currentCreature.RequiredComponents.Add(component);
break;
}
}
}
}