public Row(int index, ETableForm parent) { Parent = parent; Percentage = ClampPercentage(Parent.ETable.Percentages[index]); EncounterId = ClampIndex(Parent.ETable.EncounterIds[index]); PercentageBox = new NumericUpDown() { Minimum = 1, Maximum = 100, Dock = DockStyle.Fill, Value = Percentage }; PercentageBox.ValueChanged += PercentageBox_ValueChanged; EncounterBox = new ComboBox() { Dock = DockStyle.Fill }; EncounterBox.SelectedIndexChanged += EncounterBox_SelectedIndexChanged; RefreshEncounterList(); Parent.EncounterTable.Controls.Add(PercentageBox, 0, index); Parent.EncounterTable.Controls.Add(EncounterBox, 1, index); }
private void EditETableButton_Click(object sender, EventArgs e) { if (CurrentTile.ETableId > 0) { ETableForm form = new ETableForm(); form.Setup(Context, Zone, Zone.ETables[CurrentTile.ETableId - 1]); if (form.ShowDialog() == DialogResult.OK) { form.Apply(); Context.UnsavedChanges = true; Context.UpdateEncounters(); } } }
private void Edit() { if (Options.SelectedIndex == -1) { return; } ETable et = Zone.ETables[Options.SelectedIndex]; using (ETableForm child = new ETableForm()) { child.Setup(Context, Zone, et); if (child.ShowDialog() == DialogResult.OK) { child.Apply(); Context.UnsavedChanges = true; Context.UpdateEncounters(); } } }
public static ushort AddETable(Context context, Zone zone) { ETable et = new ETable(); using (ETableForm child = new ETableForm()) { child.Setup(context, zone, et); if (child.ShowDialog() == DialogResult.OK) { child.Apply(); zone.ETables.Add(et); context.UnsavedChanges = true; context.UpdateEncounters(); return(zone.ETableCount); } else { return(0); } } }