private void CellValueChangedHandler(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0) { return; } DataGridViewColumn column = dataGridView.Columns[e.ColumnIndex]; DataGridViewRow row = dataGridView.Rows[e.RowIndex]; DataGridViewCell cell = row.Cells[e.ColumnIndex]; MSB3.Part.Enemy enemy = enemies[e.RowIndex]; switch (column.Name) { case "Name": enemy.Name = (string)cell.Value; break; case "ModelName": enemy.ModelName = (string)cell.Value; row.Cells["Description"].Value = ChrIDs.f(enemy.ModelName); AddEnemyModel(enemy.ModelName); break; case "ThinkParamID": enemy.ThinkParamID = (int)cell.Value; break; case "NPCParamID": enemy.NPCParamID = (int)cell.Value; break; case "EventEntityID": enemy.EntityID = (int)cell.Value; break; case "TalkID": enemy.TalkID = (int)cell.Value; break; case "CharaInitID": enemy.CharaInitID = (int)cell.Value; break; case "Position": enemy.Position = ParseVector3((string)cell.Value); break; case "Rotation": enemy.Rotation = ParseVector3((string)cell.Value); break; case "Description": break; default: throw new Exception("CellValueChangedHandler missing code path"); } }
private void UpdateRow(int index) { MSB3.Part.Enemy enemy = enemies[index]; DataGridViewRow row = dataGridView.Rows[index]; row.Cells["Name"].Value = enemy.Name; row.Cells["ModelName"].Value = enemy.ModelName; row.Cells["ThinkParamID"].Value = enemy.ThinkParamID; row.Cells["NPCParamID"].Value = enemy.NPCParamID; row.Cells["EventEntityID"].Value = enemy.EntityID; row.Cells["TalkID"].Value = enemy.TalkID; row.Cells["CharaInitID"].Value = enemy.CharaInitID; row.Cells["Position"].Value = enemy.Position.ToString(); row.Cells["Rotation"].Value = enemy.Rotation.ToString(); row.Cells["Description"].Value = ChrIDs.f(enemy.ModelName); }