private void CharacterEditor_Add_Ok(object sender, EventArgs e)
        {
            this.Enabled = true;
            CharacterEditor.MainForm mf = (CharacterEditor.MainForm)sender;

            _special.Enemies.Add(mf.Character);
            _special.Distances.Add(0);

            mf.Close();
            UpdateView();
        }
        private void CharacterEditor_Edit_Ok(object sender, EventArgs e)
        {
            this.Enabled = true;
            CharacterEditor.MainForm mf = (CharacterEditor.MainForm)sender;
            mf.Close();

            Int32 i = _special.Enemies.IndexOf((Character)EnemiesListBox.SelectedItem);

            _special.Enemies[i]     = mf.Character;
            EnemiesListBox.Items[i] = mf.Character.ToString();
        }
Exemple #3
0
        private void CharacterEditor_Ok(object sender, EventArgs e)
        {
            CharacterEditor.MainForm mf = (CharacterEditor.MainForm)sender;

            String filepath = _workspaceDir + "/" + mf.Character.Name + ".char";

            if (System.IO.File.Exists(filepath))
            {
                DialogResult dr = MessageBox.Show("Character with that name already exists! Do you want to override the file?",
                                                  "Name exists", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (dr == DialogResult.No)
                {
                    return;
                }
            }

            FileHandler.FileHandler.Write(filepath, mf.Character, typeof(Model.CharacterRelated.Character));

            mf.Close();
        }