コード例 #1
0
ファイル: Item.cs プロジェクト: GarettHawke/CSharp
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteAttributeString("Type", Type.ToString());
     if (IsOpened != null)
     {
         writer.WriteAttributeString("IsOpen", IsOpened.ToString());
         if (LockBlockX != null)
         {
             writer.WriteAttributeString("BlockX", LockBlockX.ToString());
             writer.WriteAttributeString("BlockY", LockBlockY.ToString());
         }
         else if (NumberOfDiamonds != null)
         {
             writer.WriteAttributeString("Diamonds", NumberOfDiamonds.ToString());
         }
         else if (HasGoldenKey != null)
         {
             writer.WriteAttributeString("Golden", HasGoldenKey.ToString());
         }
         else if (HasSilverKey != null)
         {
             writer.WriteAttributeString("Silver", HasSilverKey.ToString());
         }
     }
 }
コード例 #2
0
 public void WriteXml(XmlWriter writer)
 {
     writer.WriteAttributeString("Number", LvlNumber.ToString());
     writer.WriteAttributeString("Name", Name);
     writer.WriteElementString("StartX", CharacterStartX.ToString());
     writer.WriteElementString("StartY", CharacterStartY.ToString());
     writer.WriteElementString("EndX", CharacterEndX.ToString());
     writer.WriteElementString("EndY", CharacterEndY.ToString());
     writer.WriteElementString("InLevel", NumberOfDiamonds.ToString());
     writer.WriteElementString("Needed", NumberOfDiamondsNeeded.ToString());
     writer.WriteStartElement("Floor");
     foreach (FloorTile[] row in floor)
     {
         writer.WriteStartElement("Row");
         foreach (FloorTile tile in row)
         {
             writer.WriteStartElement("FloorTile");
             tile.WriteXml(writer);
             writer.WriteEndElement();
         }
         writer.WriteEndElement();
     }
     writer.WriteEndElement();
 }