Пример #1
0
    public void LoadXml()
    {
        Maps = new List <XMLMapData>();
        XmlDocument Document = new XmlDocument();

        Document.Load(filePath);
        XmlElement MapListElement = Document["MapList"];

        foreach (XmlElement MapElement in MapListElement.ChildNodes)
        {
            XMLMapData Map = new XMLMapData
            {
                iMapTileName = System.Convert.ToInt32(MapElement.GetAttribute("iMapTileName")),
                iMapTileX    = System.Convert.ToInt32(MapElement.GetAttribute("iMapTileX")),
                iMapTileY    = System.Convert.ToInt32(MapElement.GetAttribute("iMapTileY")),
                fType        = System.Convert.ToSingle(MapElement.GetAttribute("fType")),
            };
            Maps.Add(Map);
        }
    }