private void initControls() { GameBoardUI.e_BoardSize i_BoardSize = m_FormNameLogin.BoardSizeSelection; string player1Name = m_FormNameLogin.Player1Name; string player2Name = m_FormNameLogin.Player2Name; int boardSizeAsInt = (int)i_BoardSize; Player Player1 = new Player(player1Name, boardSizeAsInt, 1, false); Player Player2 = new Player(player2Name, boardSizeAsInt, 2, !m_FormNameLogin.ComputerOrNot); Player1.InitAllTheCheckersOfOnePlayer(boardSizeAsInt, Player.e_LocationOfThePlayer.UP); Player2.InitAllTheCheckersOfOnePlayer(boardSizeAsInt, Player.e_LocationOfThePlayer.DOWN); m_Game = new Game(Player1, Player2, boardSizeAsInt); m_Board = new GameBoardUI(i_BoardSize); locateBoardOnTheForm(boardSizeAsInt); startGame(m_Game); }
void m_ButtonDone_Click(object sender, EventArgs e) { this.DialogResult = DialogResult.OK; if (m_RadioButtonSmallBoard.Checked) { m_BoardSizeSelection = GameBoardUI.e_BoardSize.Small; } else if (m_RadioButtonMediumBoard.Checked) { m_BoardSizeSelection = GameBoardUI.e_BoardSize.Medium; } else if (m_RadioButtonLargeBoard.Checked) { m_BoardSizeSelection = GameBoardUI.e_BoardSize.Large; } this.Close(); }
private void buttonDone_Click(object sender, EventArgs e) { bool userChoosedSize = true; LogInExceptionForm logInException; if ((Player1Name.Length > 0) && (Player2Name.Length > 0) && (Player1Name.Length < 15) && (Player2Name.Length < 15)) { if (boardGameSmallSize.Checked) { m_BoardSizeSelection = GameBoardUI.e_BoardSize.Small; } else if (boardGameMediumSize.Checked) { m_BoardSizeSelection = GameBoardUI.e_BoardSize.Medium; } else if (boardGameLargeSize.Checked) { m_BoardSizeSelection = GameBoardUI.e_BoardSize.Large; } else { userChoosedSize = false; } if (userChoosedSize) { this.DialogResult = DialogResult.OK; } else { logInException = new LogInExceptionForm(ConstantsUI.k_BoardSizeLogInException, ConstantsUI.k_BoardSizeLogInExceptionTitle); logInException.ShowDialog(); } } else { logInException = new LogInExceptionForm(ConstantsUI.k_NameLogInException, ConstantsUI.k_NameLogInExceptionTitle); logInException.ShowDialog(); } }
private void InitControls() { GameBoardUI.e_BoardSize i_BoardSize = m_FormNameLogin.BoardSizeSelection; string player1Name = m_FormNameLogin.Player1Name; string player2Name = m_FormNameLogin.Player2Name; Player Player1 = new Player(player1Name, (int)i_BoardSize, 1, false); Player Player2 = new Player(player2Name, (int)i_BoardSize, 2, false); Player1.InitAllTheCheckersOfOnePlayer((int)i_BoardSize, Player.e_LocationOfThePlayer.DOWN); Player2.InitAllTheCheckersOfOnePlayer((int)i_BoardSize, Player.e_LocationOfThePlayer.UP); Game = new Game(Player1, Player2, (int)i_BoardSize); m_Board = new GameBoardUI(i_BoardSize); initCheckers(Player1, Player2, Game); for (int i = 0; i < (int)i_BoardSize; i++) { for (int j = 0; j < (int)i_BoardSize; j++) { m_Board.GetBoard[i, j].Size = new Size(60, 60); m_Board.GetBoard[i, j].Location = new Point((i) * 60, (j + 1) * 60); this.Controls.Add(m_Board.GetBoard[i, j]); } } }