예제 #1
0
        internal void Load(XmlReader xr)
        {
            List <TiledMapObject> objects = new List <TiledMapObject>();

            while (!(xr.NodeType == XmlNodeType.EndElement && xr.Name == "objectgroup") && xr.Read())
            {
                if (xr.Name == "properties")
                {
                    using (XmlReader r = XmlReader.Create(new StringReader(xr.ReadOuterXml())))
                        Properties = TiledProperties.Load(r);
                }
                if (xr.Name == "object" && xr.NodeType != XmlNodeType.EndElement)
                {
                    using (XmlReader r = XmlReader.Create(new StringReader(xr.ReadOuterXml())))
                        objects.Add(TiledMapObject.FromXML(r));
                }
            }
            Objects = objects.ToArray();
        }