Beispiel #1
0
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Allow the user to choose a name and a location
            OpenFileDialog dialog = new OpenFileDialog();


            dialog.Filter = "XML Files | *.xml";

            dialog.InitialDirectory = ".";
            dialog.Title            = "Choose the file to open.";


            DialogResult result = dialog.ShowDialog();

            currentFileName = dialog.FileName;

            if (result == DialogResult.OK)
            {
                objects = new List <PhysicsObject>();
                vertical_lines.Clear();
                horizontal_lines.Clear();
                diagonal_lines.Clear();
                door   = null;
                player = null;
                LevelCreator.ParseLevelFromFile(currentFileName, this);
                this.currentState = State.EDITING;
                pb_Level.Refresh();
            }
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Console.Write("Type in the number of which level to build (none for test level): ");
            int       input;
            LevelData ExampleData;
            string    exportPath = "../../../NDE/NDEContent/levels/";

            try
            {
                input = Convert.ToInt32(Console.ReadLine());
            }
            catch (OverflowException)
            {
                input = 0;
            }
            catch (FormatException)
            {
                input = 0;
            }

            if (input > 0)
            {
                exportPath += "level" + input + ".xml";
                LevelCreator newLevel = new LevelCreator();
                ExampleData = newLevel.buildLevel(Convert.ToInt32(input));
            }
            else
            {
                exportPath += "dummyLevel.xml";
                ExampleData = dummyLevel();
            }

            // Set up XML writer
            XmlWriterSettings settings = new XmlWriterSettings();

            settings.Indent = true;

            // Export directly to NDEContent directory for immediate deserialization
            using (XmlWriter writer = XmlWriter.Create(exportPath, settings))
                IntermediateSerializer.Serialize(writer, ExampleData, null);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.Write("Type in the number of which level to build (none for test level): ");
            int input;
            LevelData ExampleData;
            string exportPath = "../../../NDE/NDEContent/levels/";
            try
            {
                input = Convert.ToInt32(Console.ReadLine());
            }
            catch (OverflowException)
            {
                input = 0;
            }
            catch (FormatException)
            {
                input = 0;
            }

            if (input > 0)
            {
                exportPath += "level" + input + ".xml";
                LevelCreator newLevel = new LevelCreator();
                ExampleData = newLevel.buildLevel(Convert.ToInt32(input));
            }
            else
            {
                exportPath += "dummyLevel.xml";
                ExampleData = dummyLevel();
            }

            // Set up XML writer
            XmlWriterSettings settings = new XmlWriterSettings();
            settings.Indent = true;

            // Export directly to NDEContent directory for immediate deserialization
            using (XmlWriter writer = XmlWriter.Create(exportPath, settings))
                IntermediateSerializer.Serialize(writer, ExampleData, null);
        }