示例#1
0
        /// <summary>
        /// Renders the specified map viewer.
        /// </summary>
        /// <param name="mapViewer">The map viewer.</param>
        /// <param name="drawingContext">The drawing context.</param>
        /// <param name="playerColor">Color of the player.</param>
        public void Render(CustomControls.MapViewer mapViewer, System.Windows.Media.DrawingContext drawingContext, System.Windows.Media.Color playerColor)
        {
            if (mapViewer.IsInView(position))
            {
                Rect rect = mapViewer.GetRectangle((int)position.X, (int)position.Y);

                drawingContext.DrawImage(Tile, rect);
            }

            foreach (Point point in controlledCases)
            {
                if (mapViewer.IsInView(point))
                {
                    Rect rect = mapViewer.GetRectangle((int)point.X, (int)point.Y);

                    SolidColorBrush myBrush = new SolidColorBrush(playerColor);
                    myBrush.Opacity = 0.3;
                    drawingContext.DrawRectangle(myBrush, null, rect);
                }
            }
        }