Example #1
0
 /// <summary>
 /// This method outputs all the attributes of a zone.  Tile membership in a zone
 /// is determined in the sections file.
 /// </summary>
 /// <param name="w"></param>
 public void ToXml(XmlWriter w)
 {
     w.WriteStartElement("Zone");
     w.WriteAttributeString("Name", name);
     properties.ToXml(w);
     w.WriteEndElement();
 }
        public void ToXml(string worldPath)
        {
            XmlWriterSettings xmlSettings = new XmlWriterSettings();

            xmlSettings.Indent = true;

            XmlWriter w = XmlWriter.Create(String.Format("{0}\\{1}.mwm", worldPath, worldName), xmlSettings);

            w.WriteStartElement("WorldMap");

            w.WriteAttributeString("WorldName", worldName);

            w.WriteAttributeString("MinTileX", minTile.x.ToString());
            w.WriteAttributeString("MinTileZ", minTile.z.ToString());
            w.WriteAttributeString("MaxTileX", maxTile.x.ToString());
            w.WriteAttributeString("MaxTileZ", maxTile.z.ToString());

            w.WriteAttributeString("MinHeight", minHeight.ToString());
            w.WriteAttributeString("MaxHeight", maxHeight.ToString());

            // write world level properties
            properties.ToXml(w);

            // write zones
            foreach (MapZone zone in zones.Values)
            {
                zone.ToXml(w);
            }

            // write layers
            foreach (MapLayer layer in layers.Values)
            {
                layer.ToXml(w);
            }

            // world end
            w.WriteEndElement();
            w.Close();
        }