コード例 #1
0
ファイル: Form1.cs プロジェクト: francot514/Hedgewars-Editor
        private void button5_Click(object sender, EventArgs e)
        {
            // Displays a message box with the yes and no options.
                    DialogResult Response = MessageBox.Show("Want to create a new mission?" + Environment.NewLine + "This will delete all your current progress", "Hegewars Mission", MessageBoxButtons.OKCancel);

                    // If statement to check if the yes button was selected.
                    if (Response == DialogResult.OK)
                    {
                        mission = new Mission(1);

                        try
                            {
                               mission.CreateMission(missionname + ".lua");

                            }
                        catch (Exception ex)
                            {

                                ex = new Exception();
                                MessageBox.Show("Cannot create mission");
                            }

                    }
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: francot514/Hedgewars-Editor
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (mission != null)
                {

                    if (comboBox1.SelectedItem == null)
                        {
                        MessageBox.Show("No map terrain selected");
                    return;
                        }

                    if (comboBox4.SelectedItem == null)
                    {
                        MessageBox.Show("No map theme selected");
                        return;
                    }

                        if (mission.Terrain.HasValue == false)
                        mission.SetTerrain(comboBox1.SelectedItem.ToString(), comboBox4.SelectedItem.ToString());

                        mission.SaveMission();
                        label95.Text = mission.Terrain.gameflagcount.ToString();
                        MessageBox.Show("Mission has been saved");

                    try
                    {
                    }
                    catch (Exception ex)
                    {
                        ex = new Exception();
                        MessageBox.Show("Cannot save the mission");
                    }

                }
            else
                {

                    label95.Text = mission.Terrain.gameflagcount.ToString();
                    saveFileDialog1.InitialDirectory = Properties.Settings.Default.Gamepath;
                    saveFileDialog1.Filter = "Hedgewars Mission file (*.lua)|*.lua|All Files (*.*)|*.*";
                    saveFileDialog1.FilterIndex = 1;

                if ((this.saveFileDialog1.ShowDialog() == DialogResult.OK)) {

                  mission = new Mission(1);
                  mission.CreateMission("New", saveFileDialog1.FileName);
                  mission.SaveMission();
                  MessageBox.Show("Mission has been saved");

                }

                }
        }