Exemplo n.º 1
0
        private void getErrorMessage(GameManager.eResponseCode i_Error)
        {
            string message;
            bool   endOfGame = false;

            switch (i_Error)
            {
            case GameManager.eResponseCode.NoValidCellsForPlayer:
                message = "You have no valid cells. The turn will be moved to the second player";
                break;

            case GameManager.eResponseCode.NoValidCellsForBothPlayers:
                message   = endOfGameMessage();
                endOfGame = true;
                break;

            default:
                message = string.Empty;
                break;
            }

            if (message != string.Empty && m_Manager.CurrentPlayer.PlayerID != Player.ePlayerID.Computer)
            {
                displayMessageBox(message, endOfGame);
            }
        }
Exemplo n.º 2
0
        private void pictureBox_Click(object sender, MouseEventArgs e)
        {
            PictureBox picBox = sender as PictureBox;
            int        x      = tableLayoutPanelGame.GetRow(picBox);
            int        y      = tableLayoutPanelGame.GetColumn(picBox);

            GameManager.eResponseCode reponse = m_Manager.PlayTurn(x, y);
            refreshBoard(reponse);
        }
Exemplo n.º 3
0
        private void refreshBoard(GameManager.eResponseCode i_Response = GameManager.eResponseCode.OK)
        {
            if (i_Response != GameManager.eResponseCode.OK)
            {
                getErrorMessage(i_Response);
            }

            if (!m_UserEndGame)
            {
                printBoard();
                GameManager.eResponseCode response = isBoardValid();
                if (response != GameManager.eResponseCode.OK)
                {
                    getErrorMessage(response);
                }

                Text = string.Format("Othello - {0}'s Turn", m_Manager.CurrentPlayer == m_Manager.Player1 ? k_Player1 : k_Player2);
            }
        }