Пример #1
0
        public Map getMap()
        {
            Map map = new Map();
            map.solarsystems = solarsystemMap;
            map.randomArea = randomArea;

            map.systemcount = int.Parse(Systemcount.Text);
            map.min_distance = int.Parse(Min_distance.Text);
            return map;
        }
Пример #2
0
        /// <summary>
        /// Liefert die aktuell geladene Map zurück
        /// </summary>
        /// <returns>Liefert die Map zurück</returns>
        public Map getCurrentMap()
        {
            Map map2 = new Map();
            map2.solarsystems = systemList;
            map2.randomArea = loadedMap.randomArea;

            map2.systemcount = loadedMap.systemcount;
            map2.min_distance = loadedMap.min_distance;

            return map2;
        }
Пример #3
0
        public void loadMap(Map map)
        {
            panel1.Controls.Clear();
            GraphicHelper gr = new GraphicHelper(panel1.Width, panel1.Height);
            panel1.BackgroundImage = gr.flush();

            solarsystemMap.Clear();
            refferenzTable.Clear();
            refferenzTable2.Clear();
            randomArea = null;
            randomArea = map.randomArea;
            randomAreaReady = true;

            Systemcount.Text = map.systemcount.ToString();
            Min_distance.Text = map.min_distance.ToString();

            List<Solarsystem> systems = map.solarsystems;

            foreach (Solarsystem system in systems)
            {

                PictureBox picture = new PictureBox();
                panel1.Controls.Add(picture);
                picture.Image = getImage("sun");
                picture.Left = system.x;
                picture.Top = system.y;
                picture.Width = picture.Image.Width;
                picture.Height = picture.Image.Height;
                picture.Visible = true;

                picture.MouseClick += new MouseEventHandler(picture_Click);

                solarsystemMap.Add(system);

                refferenzTable.Add(picture, system);
                refferenzTable2.Add(system, picture);

            }

            checkNodes();
            printConnections();
        }
Пример #4
0
        private void saveMap()
        {
            // Speichern der Datei:
            Translator tr = new Translator();

            List<ClassContainer> liste = new List<ClassContainer>();
            Map map2 = new Map();
            map2.solarsystems = systemList;
            map2.randomArea = loadedMap.randomArea;

            map2.systemcount = loadedMap.systemcount;
            map2.min_distance = loadedMap.min_distance;
            ClassContainer container2 = new ClassContainer();
            container2.objekt = map2;
            container2.type = ClassType.Map;
            liste.Add(container2);

            tr.writeData(liste, "created.map");
        }
Пример #5
0
        /// <summary>
        /// Läd ein bestimmtes Map-Objekt in da System
        /// </summary>
        /// <param name="map">Map die geladen werden soll</param>
        public void setMap(Map map)
        {
            loadedMap = map;

            systemList = map.solarsystems;
            usersystems.Clear();

            foreach (Solarsystem system in systemList)
            {
                if (system.userstart)
                {
                    usersystems.Add(system);
                }

            }
        }
Пример #6
0
        private void speichernToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                SaveFileDialog save = new SaveFileDialog();
                save.Filter = "Map-File | *.map";
                if (save.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Translator tr = new Translator();
                    List<ClassContainer> list = new List<ClassContainer>();
                    Map map = new Map();
                    map.solarsystems = solarsystemMap;
                    map.randomArea = randomArea;

                    map.systemcount = int.Parse(Systemcount.Text);
                    map.min_distance = int.Parse(Min_distance.Text);

                    ClassContainer container = new ClassContainer();
                    container.objekt = map;
                    container.type = ClassType.Map;
                    list.Add(container);

                    tr.writeData(list, save.FileName);

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Fehler: " + ex.Message);
            }
        }