Ejemplo n.º 1
0
        public static List <LevelEditorObject> Load_From_XML(string filename)
        {
            List <LevelEditorObject> Res = new List <LevelEditorObject>();
            root MainObject = null;

            MainObject = new root();

            StreamReader  SR   = new StreamReader(filename);
            XmlSerializer xSer = new XmlSerializer(typeof(root));

            MainObject = (root)xSer.Deserialize(SR);
            SR.Close();

            foreach (rootObject obj in MainObject.Object)
            {
                LevelEditorObject le = ObjectGenerator.GetEditorObject(obj.OName);
                if (le != null)
                {
                    le.name         = obj.OName;
                    le.x            = obj.X;
                    le.y            = obj.Y;
                    le.ParamInt[0]  = obj.Int1;
                    le.ParamInt[1]  = obj.Int2;
                    le.ParamInt[2]  = obj.Int3;
                    le.Parambool[0] = obj.Bool1;
                    le.Parambool[1] = obj.Bool2;
                    le.Parambool[2] = obj.Bool3;

                    Res.Add(le);
                }
            }

            return(Res);
        }