private void btnOk_Click(object sender, EventArgs e) { SetControls(false); Copy CopyObj = new Copy(); CopyObj.CopyChance = chkChance.Checked; CopyObj.CopyTerrain = chkTerrain.Checked; CopyObj.CopyDifficulty = chkDifficulty.Checked; CopyObj.CopyGroups = chkGroups.Checked; CopyObj.CopyLocations = chkLocations.Checked; CopyObj.CopyFlags = chkFlags.Checked; CopyObj.Overwrite = chkOverwrite.Checked; ICopyObj = CopyObj; this.Close(); }
public void ReplaceSelectedZone(IZone zone, ICopy ICopyParams) { int x = SelectedZone.X; int y = SelectedZone.Y; IZone copyzone = zone.Clone(); if (ICopyParams is Copy) { Copy CopyParams = (Copy)ICopyParams; IExtZone ExtSelectedZone = (IExtZone)SelectedZone; IExtZone ExtCopyZone = (IExtZone)copyzone; if (CopyParams.CopyDifficulty) { ExtSelectedZone.Difficulty = ExtCopyZone.Difficulty; } if (CopyParams.CopyGroups) { if (CopyParams.Overwrite) { ExtSelectedZone.EncounterGroups = ExtCopyZone.EncounterGroups; } else { ExtSelectedZone.EncounterGroups.AddRange(ExtCopyZone.EncounterGroups); ExtSelectedZone.EncounterGroups = Utils.RemoveDuplicates <EncounterZoneGroup>(ExtSelectedZone.EncounterGroups); } } if (CopyParams.CopyLocations) { if (CopyParams.Overwrite) { ExtSelectedZone.EncounterLocations = ExtCopyZone.EncounterLocations; } else { ExtSelectedZone.EncounterLocations.AddRange(ExtCopyZone.EncounterLocations); ExtSelectedZone.EncounterLocations = Utils.RemoveDuplicates <EncounterZoneLocation>(ExtCopyZone.EncounterLocations); } } if (ExtSelectedZone.EncounterGroups == null) { ExtSelectedZone.EncounterGroups = new List <EncounterZoneGroup>(); } if (ExtSelectedZone.EncounterLocations == null) { ExtSelectedZone.EncounterLocations = new List <EncounterZoneLocation>(); } } if (ICopyParams.CopyTerrain) { SelectedZone.Terrain = copyzone.Terrain; } if (ICopyParams.CopyChance) { SelectedZone.Chance = copyzone.Chance; } SelectedZone.Brushed = copyzone.Brushed; SelectedZone.X = x; SelectedZone.Y = y; SaveSelected(); }