本文整理汇总了C#中System.Xml.XmlDictionaryWriter.WriteCustomObject方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryWriter.WriteCustomObject方法的具体用法?C# XmlDictionaryWriter.WriteCustomObject怎么用?C# XmlDictionaryWriter.WriteCustomObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Xml.XmlDictionaryWriter
的用法示例。
在下文中一共展示了XmlDictionaryWriter.WriteCustomObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializeNPC
public static void SerializeNPC(Terraria.NPC npc, XmlDictionaryWriter writer, bool SetDefaults_Int32 = true)
{
writer.WriteString("\n\t");
writer.WriteStartElement("NPC");
foreach (var feild in Feilds)
{
switch (feild)
{
case "ConfusionImmunity":
writer.WriteCustomObject(npc.buffImmune[31], feild);
break;
case "PoisonImmunity":
writer.WriteCustomObject(npc.buffImmune[20], feild);
break;
case "BurningImmunity":
writer.WriteCustomObject(npc.buffImmune[24], feild);
break;
case "CurseImmunity":
writer.WriteCustomObject(npc.buffImmune[39], feild);
break;
case "Name":
writer.WriteCustomObject(npc.name, feild);
break;
case "Type":
if (SetDefaults_Int32)
writer.WriteCustomObject(npc.type, feild);
else
writer.WriteCustomObject(npc.type, "Inherits");
break;
case "aiStyle":
writer.WriteCustomObject(npc.aiStyle, feild);
break;
case "scale":
writer.WriteCustomObject(npc.scale, feild);
break;
case "damage":
writer.WriteCustomObject(npc.damage, feild);
break;
case "defense":
writer.WriteCustomObject(npc.defense, feild);
break;
case "lifeMax":
writer.WriteCustomObject(npc.lifeMax, feild);
break;
case "value":
writer.WriteCustomObject(npc.value, feild);
break;
case "knockBackResist":
writer.WriteCustomObject(npc.knockBackResist, feild);
break;
case "Width":
writer.WriteCustomObject(npc.width, feild);
break;
case "Height":
writer.WriteCustomObject(npc.height, feild);
break;
case "slots":
writer.WriteCustomObject(npc.npcSlots, feild);
break;
case "noTileCollide":
writer.WriteCustomObject(npc.noTileCollide, feild);
break;
case "noGravity":
writer.WriteCustomObject(npc.noGravity, feild);
break;
case "behindTiles":
writer.WriteCustomObject(npc.behindTiles, feild);
break;
case "DisplayName":
if(npc.displayName != npc.name)
writer.WriteCustomObject(npc.displayName, feild);
break;
case "NetAlways":
writer.WriteCustomObject(npc.netAlways, feild);
break;
case "netSkip":
writer.WriteCustomObject(npc.netSkip, feild);
break;
case "NetID":
writer.WriteCustomObject(npc.netID, feild);
break;
default:
throw new Exception("This class is feild specific! Please add the relative feild above [" + feild + "]");
}
}
writer.WriteString("\n\t");
writer.WriteEndElement();
}