示例#1
0
        public void DrawPath(List <ushort> path)
        {
            var pen2 = new Pen(Brushes.LawnGreen, 15f);

            pen2.DashStyle = new DashStyle(new DoubleCollection {
                2
            }, 2);

            using (DrawingContext dc = picPathOverlay.RenderOpen())
            {
                for (int i = -1; i < path.Count - 1; i++)
                {
                    SkillNode n1 = i == -1
                        ? Skillnodes[path[i + 1]].Neighbor.First(sn => SkilledNodes.Contains(sn.Id))
                        : Skillnodes[path[i]];
                    SkillNode n2 = Skillnodes[path[i + 1]];

                    DrawConnection(dc, pen2, n1, n2);
                }
            }
        }
示例#2
0
        public void DrawRefundPreview(HashSet <ushort> nodes)
        {
            var pen2 = new Pen(Brushes.Red, 15f);

            pen2.DashStyle = new DashStyle(new DoubleCollection {
                2
            }, 2);

            using (DrawingContext dc = picPathOverlay.RenderOpen())
            {
                foreach (ushort node in nodes)
                {
                    foreach (SkillNode n2 in Skillnodes[node].Neighbor)
                    {
                        if (SkilledNodes.Contains(n2.Id) && (node < n2.Id || !(nodes.Contains(n2.Id))))
                        {
                            DrawConnection(dc, pen2, Skillnodes[node], n2);
                        }
                    }
                }
            }
        }
示例#3
0
        public void DrawPath(List <ushort> path)
        {
            var pen2 = new Pen(Brushes.LawnGreen, 15f);

            pen2.DashStyle = new DashStyle(new DoubleCollection {
                2
            }, 2);

            using (DrawingContext dc = picPathOverlay.RenderOpen())
            {
                // Draw a connection from a skilled node to the first path node.
                var skilledNeighbors = new List <SkillNode>();
                if (path.Count > 0)
                {
                    skilledNeighbors = Skillnodes[path[0]].VisibleNeighbors.Where(sn => SkilledNodes.Contains(sn.Id)).ToList();
                }
                // The node might not be connected to a skilled node through visible neighbors
                // in which case we don't want to draw a connection anyway.
                if (skilledNeighbors.Any())
                {
                    DrawConnection(dc, pen2, skilledNeighbors.First(), Skillnodes[path[0]]);
                }

                // Draw connections for the path itself (only those that should be visible).
                for (var i = 0; i < path.Count - 1; i++)
                {
                    var n1 = Skillnodes[path[i]];
                    var n2 = Skillnodes[path[i + 1]];
                    if (n1.VisibleNeighbors.Contains(n2))
                    {
                        DrawConnection(dc, pen2, n1, n2);
                    }
                }
            }
        }