private void openToolStripMenuItem_Click(object sender, EventArgs e) { LevelData OpenedLevel = LevelData.LoadLevel(); if (OpenedLevel != null) { level = OpenedLevel; textures = new TextureBaseData[level.textures.Length]; for (int i = 0; i < level.textures.Length; i++) { textures[i] = new TextureBaseData(level.textures[i]); } UpdateTextureLists(); PutPicturesInPanel(); textBoxWidth.Text = level.levelWidth.ToString(); textBoxHeight.Text = level.levelHeight.ToString(); if (level.zombieSpawnAcceleration) { comboBoxSpawnAcceleration.SelectedIndex = 0; } else { comboBoxSpawnAcceleration.SelectedIndex = 1; } } }
private void addToolStripMenuItem_Click(object sender, EventArgs e) { //Stream myStream = null; OpenFileDialog openFileDialog1 = new OpenFileDialog(); openFileDialog1.Title = "Open Image"; //openFileDialog1.InitialDirectory = "c:\\"; openFileDialog1.Filter = "PNG files (*.png)|*.png"; //openFileDialog1.FilterIndex = 2; //openFileDialog1.RestoreDirectory = true; if (openFileDialog1.ShowDialog() == DialogResult.OK) { try { TextureBaseData texture = new TextureBaseData(new Bitmap(openFileDialog1.FileName), openFileDialog1.SafeFileName); List <TextureBaseData> newTextures = new List <TextureBaseData>(); newTextures.AddRange(textures); newTextures.Add(texture); textures = newTextures.ToArray(); UpdateTextureLists(); comboBoxSolidTexture.SelectedIndex = newTextures.FindIndex((x) => x == texture); } catch (Exception ex) { MessageBox.Show("Error: Could not read file from disk. Original error: " + ex.Message); } } openFileDialog1.Dispose(); }