Exemplo n.º 1
0
 public MapAreaSelectForm(Guid map_id, Guid map_area_id)
 {
     this.InitializeComponent();
     Application.Idle       += new EventHandler(this.Application_Idle);
     this.UseTileBtn.Visible = this.map_tiles_exist();
     this.MapBox.Items.Add("(no map)");
     foreach (Masterplan.Data.Map map in Session.Project.Maps)
     {
         this.MapBox.Items.Add(map);
     }
     Masterplan.Data.Map map1 = Session.Project.FindTacticalMap(map_id);
     if (map1 == null)
     {
         this.MapBox.SelectedIndex = 0;
         this.AreaBox.Items.Add("(no map)");
         this.AreaBox.SelectedIndex = 0;
         return;
     }
     this.MapBox.SelectedItem = map1;
     Masterplan.Data.MapArea mapArea = map1.FindArea(map_area_id);
     if (mapArea != null)
     {
         this.AreaBox.SelectedItem = mapArea;
         return;
     }
     this.AreaBox.SelectedIndex = 0;
 }
Exemplo n.º 2
0
        private void Application_Idle(object sender, EventArgs e)
        {
            this.MapLbl.Enabled = Session.Project.Maps.Count != 0;
            this.MapBox.Enabled = Session.Project.Maps.Count != 0;
            Masterplan.Data.Map selectedItem = this.MapBox.SelectedItem as Masterplan.Data.Map;
            bool flag = (selectedItem == null ? false : selectedItem.Areas.Count != 0);

            this.AreaLbl.Enabled = flag;
            this.AreaBox.Enabled = flag;
        }
Exemplo n.º 3
0
 private void MapBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.AreaBox.Items.Clear();
     Masterplan.Data.Map selectedItem = this.MapBox.SelectedItem as Masterplan.Data.Map;
     if (selectedItem != null)
     {
         this.AreaBox.Items.Add("(entire map)");
         foreach (Masterplan.Data.MapArea area in selectedItem.Areas)
         {
             this.AreaBox.Items.Add(area);
         }
         this.AreaBox.SelectedIndex = 0;
     }
     this.show_map();
 }
Exemplo n.º 4
0
        private void NewBtn_Click(object sender, EventArgs e)
        {
            Masterplan.Data.Map map = new Masterplan.Data.Map()
            {
                Name = "New Map"
            };
            MapBuilderForm mapBuilderForm = new MapBuilderForm(map, false);

            if (mapBuilderForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Session.Project.Maps.Add(mapBuilderForm.Map);
                Session.Modified = true;
                this.MapBox.Items.Add(mapBuilderForm.Map);
                this.MapBox.SelectedItem = mapBuilderForm.Map;
            }
        }
Exemplo n.º 5
0
 private void show_map()
 {
     Masterplan.Data.Map selectedItem = this.MapBox.SelectedItem as Masterplan.Data.Map;
     if (selectedItem == null)
     {
         this.MapView.Map = null;
         return;
     }
     this.MapView.Map = selectedItem;
     Masterplan.Data.MapArea mapArea = this.AreaBox.SelectedItem as Masterplan.Data.MapArea;
     if (mapArea == null)
     {
         this.MapView.Viewpoint = Rectangle.Empty;
         return;
     }
     this.MapView.Viewpoint = mapArea.Region;
 }
Exemplo n.º 6
0
        private void ImportBtn_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog()
            {
                Filter = Program.ImageFilter
            };

            if (openFileDialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            Image image = Image.FromFile(openFileDialog.FileName);

            if (image == null)
            {
                return;
            }
            Tile tile = new Tile()
            {
                Image    = image,
                Category = TileCategory.Map
            };
            TileForm tileForm = new TileForm(tile);

            if (tileForm.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }
            Session.Project.Library.Tiles.Add(tileForm.Tile);
            TileData tileDatum = new TileData()
            {
                TileID = tile.ID
            };

            Masterplan.Data.Map map = new Masterplan.Data.Map()
            {
                Name = FileName.Name(openFileDialog.FileName)
            };
            map.Tiles.Add(tileDatum);
            Session.Project.Maps.Add(map);
            Session.Modified = true;
            this.MapBox.Items.Add(map);
            this.MapBox.SelectedItem = map;
        }
Exemplo n.º 7
0
        private void UseTileBtn_Click(object sender, EventArgs e)
        {
            TileSelectForm tileSelectForm = new TileSelectForm(System.Drawing.Size.Empty, TileCategory.Map);

            if (tileSelectForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                TileData tileDatum = new TileData()
                {
                    TileID = tileSelectForm.Tile.ID
                };
                Masterplan.Data.Map map = new Masterplan.Data.Map()
                {
                    Name = FileName.Name("New Map")
                };
                map.Tiles.Add(tileDatum);
                Session.Project.Maps.Add(map);
                Session.Modified = true;
                this.MapBox.Items.Add(map);
                this.MapBox.SelectedItem = map;
            }
        }
Exemplo n.º 8
0
 public DisplayNameForm(List <CombatData> combatants, Encounter enc)
 {
     this.InitializeComponent();
     Application.Idle += new EventHandler(this.Application_Idle);
     this.fCombatants  = combatants;
     this.fEncounter   = enc;
     Masterplan.Data.Map map = null;
     if (this.fEncounter.MapID != Guid.Empty)
     {
         map = Session.Project.FindTacticalMap(this.fEncounter.MapID);
     }
     if (map != null)
     {
         this.Map.Map       = map;
         this.Map.Encounter = this.fEncounter;
     }
     else
     {
         this.Pages.TabPages.Remove(this.MapPage);
     }
     this.update_list();
     this.update_stat_block();
     this.update_map_area();
 }