예제 #1
0
        Polygon GetLocatedPolygon(System.Drawing.Point coord)
        {
            Polygon p      = new Polygon();
            var     offset = HexagonalMap.HexToPixel(coord);

            offset.Y += 80;
            p.Points.Add(new Point(0, 60));
            p.Points.Add(new Point(50, 120));
            p.Points.Add(new Point(150, 120));
            p.Points.Add(new Point(200, 60));
            p.Points.Add(new Point(150, 0));
            p.Points.Add(new Point(50, 0));

            Canvas.SetTop(p, offset.Y);
            Canvas.SetLeft(p, offset.X);

            //p.MouseEnter += P_MouseEnter;
            //p.MouseLeave += P_MouseLeave;

            //p.Fill = Brushes.Transparent;

            Panel.SetZIndex(p, 0);

            p.Stroke = Brushes.Black;

            return(p);
        }
예제 #2
0
        void GenerateImages()
        {
            foreach (WorldTile item in worldMap)
            {
                var textures = item.TextureUris;
                for (int i = 0; i < textures.Count; i++)
                {
                    Image img = new Image
                    {
                        Source = new BitmapImage(textures[i])
                    };

                    var pixelCoord = HexagonalMap.HexToPixel(item.Coord);

                    Canvas.SetTop(img, pixelCoord.Y);
                    Canvas.SetLeft(img, pixelCoord.X);

                    Panel.SetZIndex(img, i);

                    canvas.Children.Add(img);
                }
            }
        }