private void MapPBox_MouseClick(object sender, MouseEventArgs e) { int index = 0; int tempX; int tempY; Rectangle tempRect = new Rectangle(); foreach (FootHold.Foothold foothold in Footholds) { tempX = (int)(Footholds.ToArray()[index].Shape.X * scale); tempY = (int)(Footholds.ToArray()[index].Shape.Y * scale); tempRect = new Rectangle(tempX, tempY, (int)(foothold.Shape.Width * scale), (int)(foothold.Shape.Height * scale)); if (tempRect.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { Edit editFoothold = new Edit(); editFoothold.Text = "Foothold: " + foothold.Data.Name; editFoothold.fh = Footholds.ToArray()[index]; editFoothold.settings = settings; editFoothold.ShowDialog(); } index++; } index = 0; foreach (Portals.Portal portal in thePortals) { tempX = (int)(thePortals.ToArray()[index].Shape.X * scale); tempY = (int)(thePortals.ToArray()[index].Shape.Y * scale); tempRect = new Rectangle(tempX, tempY, (int)(portal.Shape.Width * scale), (int)(portal.Shape.Height * scale)); if (tempRect.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { EditPortals editPortals = new EditPortals(); editPortals.Text = "Portal: " + portal.Data.Name; editPortals.portal = thePortals.ToArray()[index]; editPortals.Settings = settings; editPortals.ShowDialog(); } index++; } index = 0; foreach (SpawnPoint.Spawnpoint spawnpoint in MobSpawnPoints) { tempX = (int)(MobSpawnPoints.ToArray()[index].Shape.X * scale); tempY = (int)(MobSpawnPoints.ToArray()[index].Shape.Y * scale); tempRect = new Rectangle(tempX, tempY, (int)(spawnpoint.Shape.Width * scale), (int)(spawnpoint.Shape.Height * scale)); if (tempRect.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { SpawnpointInfo spawnInfo = new SpawnpointInfo(); spawnInfo.spawnpoint = spawnpoint; spawnInfo.Text = "Mob spawnpoint: " + spawnpoint.Data.Name; spawnInfo.ShowDialog(); } index++; } }
private void MapPBox_MouseClick(object sender, MouseEventArgs e) { int index = 0; int tempX; int tempY; Rectangle tempRect = new Rectangle(); foreach (FootHold.Foothold foothold in Footholds) { tempX= (int)(Footholds.ToArray()[index].Shape.X * scale); tempY= (int)(Footholds.ToArray()[index].Shape.Y * scale); tempRect = new Rectangle(tempX, tempY,(int)( foothold.Shape.Width * scale),(int) (foothold.Shape.Height * scale)); if (tempRect.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { Edit editFoothold = new Edit(); editFoothold.Text = "Foothold: "+ foothold.Data.Name; editFoothold.fh = Footholds.ToArray()[index]; editFoothold.settings = settings; editFoothold.ShowDialog(); } index++; } index = 0; foreach (Portals.Portal portal in thePortals) { tempX = (int)(thePortals.ToArray()[index].Shape.X * scale); tempY = (int)(thePortals.ToArray()[index].Shape.Y * scale); tempRect = new Rectangle(tempX, tempY, (int)(portal.Shape.Width * scale), (int)(portal.Shape.Height * scale)); if (tempRect.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { EditPortals editPortals = new EditPortals(); editPortals.Text = "Portal: " + portal.Data.Name; editPortals.portal = thePortals.ToArray()[index]; editPortals.Settings = settings; editPortals.ShowDialog(); } index++; } index = 0; foreach (SpawnPoint.Spawnpoint spawnpoint in MobSpawnPoints) { tempX = (int)(MobSpawnPoints.ToArray()[index].Shape.X * scale); tempY = (int)(MobSpawnPoints.ToArray()[index].Shape.Y * scale); tempRect = new Rectangle(tempX, tempY, (int)(spawnpoint.Shape.Width * scale), (int)(spawnpoint.Shape.Height * scale)); if (tempRect.IntersectsWith(new Rectangle(e.X, e.Y, 1, 1))) { SpawnpointInfo spawnInfo = new SpawnpointInfo(); spawnInfo.spawnpoint = spawnpoint; spawnInfo.Text = "Mob spawnpoint: " + spawnpoint.Data.Name; spawnInfo.ShowDialog(); } index++; } }