Esempio n. 1
0
        private void determineImageAccordingToPieceSign(CheckersButton i_SourcePBox, CheckersButton i_DestPBox)
        {
            Point     sourceDest        = m_Game.GetLastStep.GetDestination;
            string    sourceDestination = sourceDest.GetColCoord + sourceDest.GetRowCoord;
            BoardSlot sourceBoardSlot   = m_Game.GetGameBoard.GetBoardSlotFromIdentifierString(sourceDestination);

            if (m_Game.GetActivePlayer.GetPlayerSign == "X")
            {
                if (sourceBoardSlot.GetPieceRef().GetIsKingBoolean)
                {
                    i_DestPBox.Image = global::CheckersUI.Properties.Resources.WhiteKing;
                }
                else
                {
                    i_DestPBox.Image = global::CheckersUI.Properties.Resources.WhitePawn;
                }
            }
            else
            {
                if (sourceBoardSlot.GetPieceRef().GetIsKingBoolean)
                {
                    i_DestPBox.Image = global::CheckersUI.Properties.Resources.BlackKing;
                }
                else
                {
                    i_DestPBox.Image = global::CheckersUI.Properties.Resources.BlackPawn;
                }
            }

            i_SourcePBox.Image  = null;
            i_DestPBox.SizeMode = PictureBoxSizeMode.StretchImage;
            i_DestPBox.Update();
            i_SourcePBox.Update();
        }
Esempio n. 2
0
        private void updateMoveInWindow(MoveEventArgs i_MoveArgsElement, bool i_DidJumpOverOccured)
        {
            CheckersButton sourcePBox = m_FormBoard[i_MoveArgsElement.GetSourceRowIndex, i_MoveArgsElement.GetSourceColIndex];
            CheckersButton destPBox   = m_FormBoard[i_MoveArgsElement.GetDestRowIndex, i_MoveArgsElement.GetDestColIndex];

            if (i_DidJumpOverOccured)
            {
                CheckersButton pictureBoxToRemovePiece;
                string         MoveExecuted = i_MoveArgsElement.GetSource + ">" + i_MoveArgsElement.GetDestination;
                Board          gameBoard    = m_Game.GetGameBoard;
                BoardSlot      slotToRemove = gameBoard.GetBoardSlotFromIdentifierString(gameBoard.GetJumpedOverPieceBoardSlotIdentifier(new Step(MoveExecuted)));
                getPBoxByIdentifier(slotToRemove.GetSlotIdentifier, out pictureBoxToRemovePiece);
                pictureBoxToRemovePiece.Image = null;
                pictureBoxToRemovePiece.Update();
            }

            determineImageAccordingToPieceSign(sourcePBox, destPBox);
        }
Esempio n. 3
0
        private void initializeBoardPieces(Player[] i_Players)
        {
            string   pieceSign;
            ePlayers playerIdentifier;

            for (int i = 0; i < m_BoardSize; i++)
            {
                determinePlayerAndSignAttachmentForPotentialPiece(i, out playerIdentifier, out pieceSign);
                for (int j = 0; j < m_BoardSize; j++)
                {
                    m_AllBoardSlots[i, j] = new BoardSlot(new Point(i, j));
                    if (isPlayerRow(i))
                    {
                        if (isPieceBoardSlot(i, j))
                        {
                            m_AllBoardSlots[i, j].AttachPieceToBoardSlotAndPlayer(i_Players, pieceSign, playerIdentifier);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
        private bool destinationHasPiece(Point i_Destination, Board i_GameBoard)
        {
            BoardSlot destSlot = i_GameBoard.GetBoardSlotFromIdentifierString(i_Destination.ToString());

            return(destSlot.DoesContainsPiece());
        }
Esempio n. 5
0
 public void RemovePiece(BoardSlot i_BoardSlotThatContainsThePiece)
 {
     r_PlayerPieces.Remove(i_BoardSlotThatContainsThePiece.GetPieceRef());
 }