private void frmMain_KeyUp(object sender, KeyEventArgs e) { if (pnlWorldMap.Focused) { if (e.Control && e.KeyCode == Keys.C) { IZone zone = worldmap.GetSelectedZone(); CopiedZone = zone.Clone(); } if (e.Control && e.KeyCode == Keys.V) { ReplaceSelectedZone(CopiedZone, ICopyParams); RefreshZoneProperties(); } if ((e.KeyCode == Keys.Delete) && !e.Control && !e.Alt) { worldmap.DeleteSelected(); RefreshZoneProperties(); pctWorldMap.Refresh(); } if (e.KeyCode == Keys.Left) { worldmap.MoveSelectedZone(-1, 0); } if (e.KeyCode == Keys.Right) { worldmap.MoveSelectedZone(1, 0); } if (e.KeyCode == Keys.Up) { worldmap.MoveSelectedZone(0, -1); } if (e.KeyCode == Keys.Down) { worldmap.MoveSelectedZone(0, 1); } RefreshZoneProperties(); } }
private void toolbtnClone_Click(object sender, EventArgs e) { HandleToolButtonClick((ToolStripButton)sender); IZone zone = worldmap.GetSelectedZone(); if (zone == null) { Message.Show("No zone selected." + Environment.NewLine + "You must select a zone to clone from.", MessageBoxButtons.OK, MessageBoxIcon.Error); toolbtnClone.Checked = false; return; } if (!toolbtnClone.Checked) { worldmap.ClearAllBrushed(); pctWorldMap.Refresh(); } else { PaintZone = zone.Clone(); PaintZone.Brushed = true; } }
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(); }
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(); }