Exemplo n.º 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);
        }
Exemplo n.º 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);
        }