Ejemplo n.º 1
0
        public static void FromFile(string filename, ContentManager cm, ObjectProcessor newObjectProcessor)
        {
            objectProcessor = newObjectProcessor;
            StreamReader stream = new StreamReader(filename);
            String       str    = stream.ReadToEnd();
            XmlDocument  doc    = new XmlDocument();

            doc.LoadXml(str);

            XmlNode level  = doc.FirstChild.NextSibling;
            XmlNode layers = level.FirstChild.NextSibling;

            foreach (XmlNode layer in layers.ChildNodes)
            {
                String  layerName   = layer.FirstChild.FirstChild.InnerText;
                Vector2 scrollSpeed = ExtractVector2(layer.FirstChild.LastChild);

                XmlNode items = layer.FirstChild.NextSibling;
                foreach (XmlNode item in items.ChildNodes)
                {
                    if (item.FirstChild.Name.Equals("RectangleItemProperties"))
                    {
                        ProcessRectangleItem(layerName, scrollSpeed, item.FirstChild);
                    }
                    else if (item.FirstChild.Name.Equals("TextureItemProperties"))
                    {
                        ProcessTextureItem(layerName, scrollSpeed, item.FirstChild, cm);
                    }
                }
            }
        }
        public static void FromFile(string filename, ContentManager cm, ObjectProcessor newObjectProcessor)
        {
            objectProcessor = newObjectProcessor;
            StreamReader stream = new StreamReader(filename);
            String       str    = stream.ReadToEnd();
            XmlDocument  doc    = new XmlDocument();

            doc.LoadXml(str);

            XmlNode level  = doc.FirstChild.NextSibling;
            XmlNode layers = level.FirstChild;

            foreach (XmlNode layer in layers.ChildNodes)
            {
                Vector2 scrollSpeed = ExtractVector2(layer.LastChild.PreviousSibling);
                String  layerName   = GetLayerName(layer);

                XmlNode items = layer.FirstChild;
                foreach (XmlNode item in items.ChildNodes)
                {
                    if (item.OuterXml.StartsWith("<Item xsi:type=\"TextureItem\""))
                    {
                        ParseTextureItem(item, scrollSpeed, layerName, cm);
                    }
                    else if (item.OuterXml.StartsWith("<Item xsi:type=\"RectangleItem\""))
                    {
                        ParseRectangleItem(item, scrollSpeed, layerName);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static void FromFile(string filename, ContentManager cm, ObjectProcessor newObjectProcessor)
        {
            objectProcessor = newObjectProcessor;
            StreamReader stream = new StreamReader(filename);
            String str = stream.ReadToEnd();
            XmlDocument doc = new XmlDocument();
            doc.LoadXml(str);

            XmlNode level = doc.FirstChild.NextSibling;
            XmlNode layers = level.FirstChild;

            foreach (XmlNode layer in layers.ChildNodes)
            {
                Vector2 scrollSpeed = ExtractVector2(layer.LastChild);
                String layerName = GetLayerName(layer);

                XmlNode items = layer.FirstChild;
                foreach (XmlNode item in items.ChildNodes)
                {
                    if (item.OuterXml.StartsWith("<Item xsi:type=\"TextureItem\""))
                    {
                        ParseTextureItem(item, scrollSpeed, layerName, cm);
                    }
                    else if (item.OuterXml.StartsWith("<Item xsi:type=\"RectangleItem\""))
                    {
                        ParseRectangleItem(item, scrollSpeed, layerName);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 public void LoadLevel(string fileName, ObjectProcessor op)
 {
     LevelLoader.FromFile(fileName, this.Content, op);
 }
Ejemplo n.º 5
0
 protected void LoadLevel(string fileName, ObjectProcessor op)
 {
     orujin.LoadLevel(fileName, op);
 }