private void commitButton_Click(object sender, EventArgs e) { if (gennedTypes == null) { gennedTypes = new MapStore(); } //Open world_gen.txt openWorldgenFile.ShowDialog(); //Save it! if (openWorldgenFile.FileName == "world_gen.txt") //Having the default name means you've not specified a path { MessageBox.Show("Cancelled"); } else if (gennedTypes.isEmpty() == true) { MessageBox.Show("You've not imported any map data!"); } else if (openWorldgenFile.FileName.Substring(openWorldgenFile.FileName.Length - 4, 4) != ".txt") { string x = openWorldgenFile.FileName.Substring(openWorldgenFile.FileName.Length - 4, 4); MessageBox.Show("That doesn't appear to be a text file"); } else { HeightmapProcessing.CommitToFile(int.Parse(xComboBox.SelectedItem.ToString()), int.Parse(yComboBox.SelectedItem.ToString()), nameTextBox.Text, gennedTypes, openWorldgenFile.FileName); } }
private void goButton_Click(object sender, EventArgs e) { if (gennedTypes == null) { gennedTypes = new MapStore(); } int conversionType = 0; switch (TypeComboBox.SelectedItem.ToString()) { case "Elevation": conversionType = (int)ImportType.ELEV; break; case "Rainfall": conversionType = (int)ImportType.RAIN; break; case "Temperature": conversionType = (int)ImportType.TEMP; break; case "Drainage": conversionType = (int)ImportType.DRAIN; break; case "Savagery": conversionType = (int)ImportType.SAV; break; case "Volcanicity": conversionType = (int)ImportType.VOLC; break; default: conversionType = (int)ImportType.ELEV; break; } if (HeightmapProcessing.ProcessMap(heightmapFileNameTextbox.Text, int.Parse(xComboBox.SelectedItem.ToString()), int.Parse(yComboBox.SelectedItem.ToString()), int.Parse(offsetTextBox.Text), float.Parse(ratioTextBox.Text), conversionType, gennedTypes, TypesListBox) == true) { heightmapFileNameTextbox.Text = string.Empty; if (gennedTypes.isEmpty() != true) { commitButton.Enabled = true; xComboBox.Enabled = false; yComboBox.Enabled = false; } else { commitButton.Enabled = false; xComboBox.Enabled = true; yComboBox.Enabled = true; } } else { MessageBox.Show("Failed to process map!"); } }
public void DisplayMap(int xSize, int ySize, int type, MapStore gennedTypes) { visualisedPictureBox.Image = (Image)HeightmapProcessing.GenerateBitmapFromData(xSize, ySize, type, gennedTypes.getItem(type)); this.Show(); }