private void EditMonster(ref MonsterData editMonster) { MonsterEditWindow editWindow = new MonsterEditWindow(); editWindow.LoadMonsterToEdit(ref editMonster); if (editWindow.ShowDialog(this) == DialogResult.OK) { string MonID = editMonster.MonsterID; editMonster.Clear(); editMonster.MonsterID = MonID; MonTypeComboBoxItem selectedMonType = (MonTypeComboBoxItem)editWindow.MonsterTypeSelector.SelectedItem; editMonster.type = selectedMonType.Value; editMonster.MonsterID = editWindow.MonsterIdInput.Text; editMonster.startPos.X = Convert.ToInt32(editWindow.InitXPos.Text); editMonster.startPos.Y = Convert.ToInt32(editWindow.InitYPos.Text); foreach (MonsterAICommand cmd in editWindow.m_CmdDataList) { editMonster.Commands.Add(cmd); } MessageBox.Show("수정이 정상적으로 완료되었습니다."); } editWindow.Dispose(); }
private void MonsterAddBtn_Click(object sender, EventArgs e) { MonsterEditWindow editWindow = new MonsterEditWindow(); if (editWindow.ShowDialog(this) == DialogResult.OK) { MonsterData monster = new MonsterData(); MonTypeComboBoxItem selectedMonType = (MonTypeComboBoxItem)editWindow.MonsterTypeSelector.SelectedItem; monster.type = selectedMonType.Value; monster.MonsterID = editWindow.MonsterIdInput.Text; monster.startPos.X = Convert.ToInt32(editWindow.InitXPos.Text); monster.startPos.Y = Convert.ToInt32(editWindow.InitYPos.Text); foreach (MonsterAICommand cmd in editWindow.m_CmdDataList) { monster.Commands.Add(cmd); } m_StageMonsters.Add(monster); MonsterList.Items.Add(monster.MonsterID); } editWindow.Dispose(); }