Пример #1
0
        private void AddPlacementMoveDrawing(Piece piece)
        {
            List <Hex> hexes;

            if (_currentBoard.hivailableHexes.Count == 0)
            {
                _currentBoard.RefreshDependantBoardData();
            }
            if (piece.color == PieceColor.White)
            {
                hexes = _currentBoard.hivailableHexes.Where(kvp => kvp.Value.WhiteCanPlace).Select(kvp => kvp.Key).ToList();
            }
            else
            {
                hexes = _currentBoard.hivailableHexes.Where(kvp => kvp.Value.BlackCanPlace).Select(kvp => kvp.Key).ToList();
            }

            List <UIElement> elementList = new List <UIElement>();

            _moveToUIElementHexes.Clear();
            foreach (Hex hex in hexes)
            {
                FutureMoveDrawing hexWithImage = FutureMoveDrawing.GetFutureMoveDrawing(hex, _drawSize, _mainCanvasOffsetPoint);
                MainCanvas.Children.Add(hexWithImage.polygon);
                elementList.Add(hexWithImage.polygon);
                hexWithImage.polygon.MouseLeftButtonDown   += makeMovepolygon_MouseLeftButtonDown;
                _moveToUIElementHexes[hexWithImage.polygon] = hex;
            }
            _tempUIElements.Add(piece, elementList);
        }
Пример #2
0
        public void AddFutureMoveDrawing(Piece piece)
        {
            List <UIElement> elementList = new List <UIElement>();

            _moveToUIElementHexes.Clear();
            foreach (Move move in _currentBoard.GetMoves(false).Where(m => m.pieceToMove.Equals(piece)))
            {
                FutureMoveDrawing hexWithImage = FutureMoveDrawing.GetFutureMoveDrawing(move.hex, _drawSize, _mainCanvasOffsetPoint);
                MainCanvas.Children.Add(hexWithImage.polygon);
                elementList.Add(hexWithImage.polygon);
                hexWithImage.polygon.MouseLeftButtonDown   += makeMovepolygon_MouseLeftButtonDown;
                _moveToUIElementHexes[hexWithImage.polygon] = move.hex;
            }
            _tempUIElements.Add(piece, elementList);
        }
Пример #3
0
        public static FutureMoveDrawing GetFutureMoveDrawing(Hex hex, double size, Point offsetPoint)
        {
            HexagonDrawing    hexDrawing = GetHexagonDrawing(hex, size, offsetPoint);
            FutureMoveDrawing drawing    = new FutureMoveDrawing();

            drawing._center  = hexDrawing.center;
            drawing._piece   = hexDrawing.piece;
            drawing._polygon = hexDrawing.polygon;
            drawing._image   = hexDrawing.image;
            drawing.height   = hexDrawing.height;
            drawing.width    = hexDrawing.width;
            Canvas.SetZIndex(drawing._polygon, 99);
            drawing._polygon.Fill = Brushes.Tan;
            return(drawing);
        }