private void 저장ToolStripMenuItem_Click(object sender, EventArgs e) { saveFileDialog1.Filter = "DestroyMonster|*.xml"; saveFileDialog1.FileName = "*.xml"; saveFileDialog1.FilterIndex = 1; saveFileDialog1.RestoreDirectory = true; if (saveFileDialog1.ShowDialog() == DialogResult.OK) { dataGridView1.EndEdit(); _DestroyMonsterScriptList.clearDestroyMonsterList(); for (int i = 0; i < dataGridView1.RowCount; i++) { DestroyMonster _DestroyMonster = new DestroyMonster(); _DestroyMonster.MonsterID = dataGridView1.Rows[i].Cells[0].Value.ToString(); _DestroyMonster.QuestID = dataGridView1.Rows[i].Cells[1].Value.ToString(); _DestroyMonster.QuestLevel = dataGridView1.Rows[i].Cells[2].Value.ToString(); _DestroyMonster.DropItemID = dataGridView1.Rows[i].Cells[3].Value.ToString(); _DestroyMonster.DropItemCount = dataGridView1.Rows[i].Cells[4].Value.ToString(); _DestroyMonster.ItemProbability = dataGridView1.Rows[i].Cells[5].Value.ToString(); _DestroyMonsterScriptList.addDestroyMonsterList(_DestroyMonster); } SerializeGameRule(saveFileDialog1.FileName, _DestroyMonsterScriptList); } }
public void addDestroyMonsterList(DestroyMonster Rule) { DestroyMonsterList.Add(Rule); }