private void button1_Click(object sender, EventArgs e) { string name = NameField.Text; int width = (int)WidthField.Value; int height = (int)HeightField.Value; if (name == "") { MessageBox.Show("Please enter a map name."); return; } int mapID = Genus2D.GameData.MapInfo.GetMapID(_mapData.GetMapName()); if (!Genus2D.GameData.MapInfo.RenameMap(mapID, name)) { MessageBox.Show("A map with that name already exists."); return; } else { _mapData.SetMapName(name); } Genus2D.GameData.MapInfo.ResizeMap(mapID, width, height); _mapData.Resize(width, height); _mapData.PvpEnabled = PvpCheck.Checked; _mapData.MultiCombat = MultiCombatCheck.Checked; Genus2D.GameData.MapInfo.SaveMap(_mapData); _editor.SetMapData(_mapData, mapID); this.Close(); }
public EditMapForm(EditorForm editor, Genus2D.GameData.MapData mapData) { InitializeComponent(); _editor = editor; _mapData = mapData; NameField.Text = mapData.GetMapName(); WidthField.Value = mapData.GetWidth(); HeightField.Value = mapData.GetHeight(); PvpCheck.Checked = mapData.PvpEnabled; MultiCombatCheck.Checked = mapData.MultiCombat; }