Ejemplo n.º 1
0
        private void toolStripButton16_Click(object sender, EventArgs e)
        {
            MapObject obj = new MapObject();

            obj.Tag = new MapSoundObject();
            obj.SectionName = "Sound" + Guid.NewGuid().ToString("N");
            obj.Type = ObjectType.Sound;

            objectList.Add(obj);
            pictureBox1.Refresh();
        }
Ejemplo n.º 2
0
 private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     for (int i = 0; i < objectList.Count; i++)
     {
         MapObject obj = objectList[i];
         if ((obj.Type & filter) == obj.Type && obj.Intersects(e.X, e.Y))
         {
             SelectedObject = obj;
             isDraging = true;
             pictureBox1.Refresh(); 
             return;
         }
     }
     SelectedObject = null;
     isDraging = false;
     pictureBox1.Refresh();
 }
Ejemplo n.º 3
0
        private void toolStripButton14_Click(object sender, EventArgs e)
        {
            MapObject obj = new MapObject();

            MapResource mres = new MapResource();
            mres.Type = NaturalResourceType.Petro;
            obj.Tag = mres;
            obj.SectionName = "Resource" + Guid.NewGuid().ToString("N");
            obj.Type = ObjectType.ResOil;

            objectList.Add(obj);
            pictureBox1.Refresh();
        }
Ejemplo n.º 4
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            SimulationWorld sim = new SimulationWorld();

            if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
            {
                string dir = folderBrowserDialog1.SelectedPath;

                Configuration config = ConfigurationManager.Instance.CreateInstance(new FileLocation(Path.Combine(dir, "cities.xml")));

                foreach (KeyValuePair<string, ConfigurationSection> s in config)
                {
                    ConfigurationSection sect = s.Value;
                    MapCity city = new MapCity(sim, sect);

                    MapObject obj = new MapObject();
                    obj.Longitude = city.Longitude;
                    obj.Latitude = city.Latitude;
                    obj.Tag = city;
                    obj.Type = ObjectType.City;
                    obj.StringDisplay = city.Name;
                    obj.SectionName = sect.Name;
                    
                    cityTable.Add(sect.Name, city);

                    objectList.Add(obj);
                }

                config = ConfigurationManager.Instance.CreateInstance(new FileLocation(Path.Combine(dir, "sceneObjects.xml")));
                foreach (KeyValuePair<string, ConfigurationSection> s in config)
                {
                    ConfigurationSection sect = s.Value;

                    MapSceneObject sceObj = new MapSceneObject(sect);
                    MapObject obj = new MapObject();
                    obj.Longitude = sect.GetSingle("Longitude");
                    obj.Latitude = sect.GetSingle("Latitude");
                    obj.Type = ObjectType.Scene;
                    obj.Tag = sceObj;
                    obj.StringDisplay = sceObj.Model;
                    obj.Radius = sceObj.Radius;
                    obj.SectionName = sect.Name;
                    objectList.Add(obj);
                }

                config = ConfigurationManager.Instance.CreateInstance(new FileLocation(Path.Combine(dir, "resources.xml")));

                foreach (KeyValuePair<string, ConfigurationSection> s in config)
                {
                    ConfigurationSection sect = s.Value;

                    MapResource res = new MapResource(sim, sect);

                    MapObject obj = new MapObject();

                    obj.Longitude = res.Longitude;
                    obj.Latitude = res.Latitude;
                    obj.Tag = res;
                    if (res.Type == NaturalResourceType.Wood)
                    {
                        obj.Type = ObjectType.ResWood;
                    }
                    else if (res.Type == NaturalResourceType.Petro)
                    {
                        obj.Type = ObjectType.ResOil;
                    }
                    obj.StringDisplay = (obj.Type == ObjectType.ResOil ? "O" : "W") + res.Amount.ToString();
                    obj.Radius = res.Radius;
                    obj.SectionName = sect.Name;
                    objectList.Add(obj);
                }

                config = ConfigurationManager.Instance.CreateInstance(new FileLocation(Path.Combine(dir, "soundObjects.xml")));
                foreach (KeyValuePair<string, ConfigurationSection> s in config)
                {
                    ConfigurationSection sect = s.Value;

                    MapSoundObject sndObj = new MapSoundObject(sect);

                    MapObject obj = new MapObject();
                    obj.Longitude = sect.GetSingle("Longitude");
                    obj.Latitude = sect.GetSingle("Latitude");

                    obj.Type = ObjectType.Sound;

                    obj.Tag = sndObj;
                    obj.StringDisplay = sndObj.SFXName;
                    obj.Radius = sndObj.Radius;
                    obj.SectionName = sect.Name;
                    objectList.Add(obj);
                  
                    
                }


                config = ConfigurationManager.Instance.CreateInstance(new FileLocation(Path.Combine(dir, "soundEffect.xml")));
                foreach (KeyValuePair<string, ConfigurationSection> s in config)
                {
                    comboBox2.Items.Add(s.Key);
                }
            }
            pictureBox1.Refresh();
        }