public TalentGrid(params TalentNode[] nodes) { bUpdateMatrix = true; hoverOverNode = null; this.nodes = nodes.ToList(); if (this.nodes.Count > 1) { for (int i = 0; i != this.nodes.Count; i++) { if (this.nodes[i].parent.requiredTalentIDs.Count != 0) { this.nodes[i].nc = new List <NodeConnection>(); foreach (var item in this.nodes[i].parent.requiredTalentIDs) { var temp = this.nodes[i].parent.parentCCC.baseTalentSlot.Find(ts => ts.ID == item); if (temp != null && temp.talentNode != null) { this.nodes[i].nc.Add(new NodeConnection(temp.talentNode, this.nodes[i])); } } } } } gridRender = new RenderTarget2D(Game1.graphics.GraphicsDevice, 1366, 768); }
private void SelectMostCenteredNode() { Point middle = new Point((mPos.X), (mPos.Y)); var node = nodes.Find(n => n.pos.Contains(middle)); if (node != null) { hoverOverNode = node; return; } Point distance = new Point(0); KeyValuePair <Point, int> closestNodeAndIndex = new KeyValuePair <Point, int>(new Point(0), -1); for (int i = 0; i < nodes.Count; i++) { var delta = new Point(Math.Abs(Math.Abs(nodes[i].pos.X) - Math.Abs(middle.X)), Math.Abs(nodes[i].pos.Y) - Math.Abs(middle.Y)); if (closestNodeAndIndex.Value == -1 || (Math.Abs(closestNodeAndIndex.Key.X) + Math.Abs(closestNodeAndIndex.Key.Y)) > Math.Abs(delta.X) + Math.Abs(delta.Y)) { closestNodeAndIndex = new KeyValuePair <Point, int>(delta, i); } } if (closestNodeAndIndex.Value != -1) { hoverOverNode = nodes[closestNodeAndIndex.Value]; } else if (nodes.Count != 0) { hoverOverNode = nodes[0]; } mPos = hoverOverNode.pos.Location - new Point(32); bUpdateMatrix = true; }
internal void SelectDown() { if (hoverOverNode == null) { SelectMostCenteredNode(); return; } var tempList = new List <TalentNode>(nodes); tempList.OrderBy(n => n.nodePos.Y); var node = tempList.Find(n => n.nodePos.Y < hoverOverNode.nodePos.Y && hoverOverNode.nodePos.X == n.nodePos.X); if (node != null) { hoverOverNode = node; mPos = hoverOverNode.pos.Location - new Point(32); bUpdateMatrix = true; return; } node = tempList.Find(n => n.nodePos.Y < hoverOverNode.nodePos.Y && Math.Abs(Math.Abs(hoverOverNode.nodePos.X) - Math.Abs(n.nodePos.X)) == 1); if (node != null) { hoverOverNode = node; mPos = hoverOverNode.pos.Location - new Point(32); bUpdateMatrix = true; return; } }
public bool NodeContainsMouse(Rectangle container) { if (!container.Contains(KeyboardMouseUtility.uiMousePos)) { hoverOverNode = null; return(false); } Point p = Utilities.KeyboardMouseUtility.uiMousePos; p += mPos; p -= new Point(1366 / 2 - 32, 768 / 2 - 32); foreach (var item in nodes) { if (item.pos.Contains(p)) { hoverOverNode = item; return(true); } } hoverOverNode = null; return(false); }
public BaseTalentSlot(Point p, CharacterClassCollection CCC) { talentNode = new TalentNode(p); talentNode.parent = this; parentCCC = CCC; ID = CCC.LatestID; CCC.LatestID++; }
internal void DrawGrid(SpriteBatch sb, TalentNode n1, TalentNode n2, Color c = default(Color)) { if (nc != null) { Color dc = Color.Gold; if (c != default(Color)) { dc = c; } foreach (var item in nc) { if (item.connection.Contains(n1) && item.connection.Contains(n2)) { item.Draw(sb, dc); } } } }
public NodeConnection(TalentNode n1, TalentNode n2) { if (bInitialize) { Initialize(); } connection[0] = n1; connection[1] = n2; delta = n2.nodePos - n1.nodePos; bool bSameCollumnNeighBours = n1.nodePos.X == n2.nodePos.X && Math.Abs(n2.nodePos.Y - n1.nodePos.Y) == 1; bool bSameRowNeighbours = n1.nodePos.Y == n2.nodePos.Y && Math.Abs(n2.nodePos.X - n1.nodePos.X) == 1; if (bSameCollumnNeighBours) { Rectangle pos = new Rectangle(n1.nodePos.X * TalentNode.nodeSize, delta.Y * TalentNode.nodeSpace + n1.nodePos.Y * TalentNode.nodeSpace, TalentNode.nodeSize, TalentNode.nodeSize); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); goto end; } if (bSameRowNeighbours) { Rectangle pos = new Rectangle(delta.X * TalentNode.nodeSpace + n1.nodePos.X * TalentNode.nodeSize, n1.nodePos.Y * TalentNode.nodeSpace, TalentNode.nodeSize, TalentNode.nodeSize); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); goto end; } if (delta.X == 0) { if (delta.Y % 2 == 0) { Rectangle pos = new Rectangle(delta.X * TalentNode.nodeSpace - 1 * TalentNode.nodeSize, n1.nodePos.Y * TalentNode.nodeSpace, TalentNode.nodeSize, TalentNode.nodeSize); pos.Location += new Point(TalentNode.nodeSpace / 2, 0); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.Y > 0 ? Connection.DR : Connection.UR)); int y = 1; if (delta.Y < 0) { y = -1; } for (int i = 0; i < Math.Abs(delta.Y); i++) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y + y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } for (int i = 0; i < (Math.Abs(delta.Y) / 2) - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y + y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y + y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.Y > 0 ? Connection.UR : Connection.DR)); goto end; } else { Rectangle pos = new Rectangle(delta.X * TalentNode.nodeSpace + 1 * TalentNode.nodeSize, n1.nodePos.Y * TalentNode.nodeSpace, TalentNode.nodeSize, TalentNode.nodeSize); pos.Location += new Point(-TalentNode.nodeSpace / 2, 0); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.Y > 0 ? Connection.DL : Connection.UL)); int y = 1; if (delta.Y < 0) { y = -1; } for (int i = 0; i < Math.Abs(delta.Y); i++) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y + y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } for (int i = 0; i < (Math.Abs(delta.Y) / 2) - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y + y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y + y * TalentNode.nodeSpace, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y + y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.Y > 0 ? Connection.UL : Connection.DL)); goto end; } } else if (delta.Y == 0) { if (delta.X % 2 == 0) { Rectangle pos = new Rectangle(delta.X * TalentNode.nodeSpace * 0, n1.nodePos.Y * TalentNode.nodeSpace, TalentNode.nodeSize, TalentNode.nodeSize); pos.Location += new Point(0, -TalentNode.nodeSize + TalentNode.nodeSpace / 2); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.X > 0 ? Connection.DR : Connection.DL)); int x = 1; if (delta.X < 0) { x = -1; } for (int i = 0; i < Math.Abs(delta.X); i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } for (int i = 0; i < (Math.Abs(delta.X) / 2) - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.X > 0 ? Connection.DL : Connection.DR)); goto end; } else { Rectangle pos = new Rectangle((delta.X * 0) * TalentNode.nodeSpace, n1.nodePos.Y * TalentNode.nodeSpace, TalentNode.nodeSize, TalentNode.nodeSize); pos.Location += new Point(0, TalentNode.nodeSize - TalentNode.nodeSpace / 2); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.X > 0 ? Connection.UR : Connection.UL)); int x = 1; if (delta.X < 0) { x = -1; } for (int i = 0; i < Math.Abs(delta.X); i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } for (int i = 0; i < (Math.Abs(delta.X) / 2) - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSpace, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.X > 0 ? Connection.UL : Connection.UR)); goto end; } } bool bLongerWidth = Math.Abs(delta.X) >= Math.Abs(delta.Y); if (bLongerWidth || true) { bool bGoingUp = delta.Y < 0; Rectangle pos = new Rectangle(delta.X * TalentNode.nodeSpace * 0, n1.nodePos.Y * TalentNode.nodeSpace, TalentNode.nodeSize, TalentNode.nodeSize); pos.Location += new Point(0, -TalentNode.nodeSize + TalentNode.nodeSpace / 2); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, delta.X > 0 ? Connection.DR : Connection.DL)); int intW = Math.Abs(delta.X) / 2; int remainderWidth = Math.Abs(delta.X - (delta.X / 2)); int x = 1; if (delta.X < 0) { x = -1; } for (int i = 0; i < intW; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } for (int i = 0; i < intW; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize / 2, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } if (bGoingUp) { int y = 1; if (delta.Y > 0) { y = -1; } if (Math.Abs(delta.Y) != 1) { //if (Math.Abs(delta.X) != 1) //{ // pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); //} //else { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize * 3 / 4, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); } if (delta.X < 0) { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.UR)); } else { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.UL)); } } for (int i = 0; i < Math.Abs(delta.Y) - 2; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } for (int i = 0; i < (Math.Abs(delta.Y) / 2) - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } if (Math.Abs(delta.Y) != 1) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * (TalentNode.nodeSize / 2 + TalentNode.nodeSpace / 2), connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); if (delta.Y % 2 != 0) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * (TalentNode.nodeSpace + TalentNode.nodeSpace / 2), connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } else { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * (TalentNode.nodeSpace / 2), connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * TalentNode.nodeSpace, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); if (delta.X < 0) { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.DL)); } else { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.DR)); } } else { pos = new Rectangle(connectionPathPos.Last().Key.X + x * (TalentNode.nodeSize) * 3 / 4, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } for (int i = 0; i < remainderWidth - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } for (int i = 0; i < remainderWidth - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize / 2, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } //if (Math.Abs(delta.X) != 1) //{ // pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize / 2, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); //} //else { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize * 3 / 4, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); } if (delta.X < 0) { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.UR)); } else { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.UL)); } } else { int y = -1; if (delta.Y != -1) { //if (Math.Abs(delta.X) != 1) //{ // pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); //} //else { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize * 3 / 4, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); } if (delta.X < 0) { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.DR)); } else { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.DL)); } } for (int i = 0; i < Math.Abs(delta.Y) - 2 + 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * TalentNode.nodeSize, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } for (int i = 0; i < (Math.Abs(delta.Y)) - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * TalentNode.nodeSize / 2, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } if (Math.Abs(delta.Y) != -1) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * (TalentNode.nodeSize / 2 + TalentNode.nodeSpace / 2), connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); if (Math.Abs(delta.Y) != 1) { if (delta.Y % 2 != 0) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * (TalentNode.nodeSpace + TalentNode.nodeSpace / 2), connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } else { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * (TalentNode.nodeSpace / 2), connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } } if (Math.Abs(delta.Y) == 1) { pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * (TalentNode.nodeSize) * 1 / 4, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.V)); } pos = new Rectangle(connectionPathPos.Last().Key.X, connectionPathPos.Last().Key.Y - y * TalentNode.nodeSpace, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); if (delta.X < 0) { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.UL)); } else { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.UR)); } } else { pos = new Rectangle(connectionPathPos.Last().Key.X + x * (TalentNode.nodeSize), connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } for (int i = 0; i < remainderWidth - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } for (int i = 0; i < remainderWidth - 1; i++) { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize / 2, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.H)); } //if (Math.Abs(delta.X) != 1) //{ // pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize / 2, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); //} //else { pos = new Rectangle(connectionPathPos.Last().Key.X + x * TalentNode.nodeSize * 3 / 4, connectionPathPos.Last().Key.Y, connectionPathPos.Last().Key.Width, connectionPathPos.Last().Key.Height); } if (delta.X < 0) { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.DR)); } else { connectionPathPos.Add(new KeyValuePair <Rectangle, Connection>(pos, Connection.DL)); } } } else { bool bGoingRight = delta.X > 0; } end : { } for (int i = 0; i < connectionPathPos.Count; i++) { var r = connectionPathPos[i].Key; connectionPathPos[i] = new KeyValuePair <Rectangle, Connection>(new Rectangle(r.X + (n1.nodePos.X) * 64 + (n1.nodePos.X) * 32, r.Y + n1.nodePos.Y * 64, r.Width, r.Height), connectionPathPos[i].Value); } }