Example #1
0
        public static void ReportRoundResult(List <InteractiveGameBoardButton> i_PlayerSelection, List <ComputerSelectionButton> i_ComputerPassWord, int i_RoundNumber)
        {
            List <Button> resultButtons = Game.Board.GetResultButtonsInRound(i_RoundNumber);

            checkColorsInPlace(i_PlayerSelection, i_ComputerPassWord, resultButtons);
            bool winner = checkWinnerState(resultButtons);

            if (winner || i_RoundNumber + 1 == Game.RoundsNumber)
            {
                showRandomComputerSelection(i_ComputerPassWord);
                if (winner)
                {
                    MessageBox.Show("Congratulations You Win!");
                }
                else
                {
                    MessageBox.Show("You Lost Try Again!");
                }

                PlayAgain playAgain = new PlayAgain();
                playAgain.ShowDialog();
            }
            else
            {
                GameManger.SetButtonsToEnable(Game.Board.GetInteractiveGameBoradButtonsInRound(i_RoundNumber + 1));
            }
        }
Example #2
0
        protected override void OnClick(EventArgs e)
        {
            ColorsMenu colorsMenu = new ColorsMenu();

            colorsMenu.ShowDialog();
            Color playerSelectionColor = colorsMenu.PlayerSelectedColor;

            if (playerSelectionColor != Color.Empty)
            {
                if (GameManger.CheckIfColorChosedBefor(playerSelectionColor) &&
                    playerSelectionColor != this.BackColor)
                {
                    MessageBox.Show("This Color Chosen Befor!");
                }
                else
                {
                    GameManger.ChosenColorsInOneRound[m_column] = playerSelectionColor;
                    this.BackColor = playerSelectionColor;
                    if (GameManger.HowManyColorsChosenInRound() == GameElements.NumberOfButtonsInRow)
                    {
                        GameBoard.m_FeedBackButtons[m_row].Enabled = true;
                    }
                }
            }
        }
 public ComputerSelectionButton(int i_SerialNumberInRow)
 {
     this.Enabled   = false;
     this.BackColor = Color.Black;
     this.SetBounds(
         GameElements.InitialButtonLeftLocation + (i_SerialNumberInRow * (GameElements.ButtonWidht + GameElements.Delta)),
         GameElements.InitialComputerSelectionButtonTop,
         GameElements.ButtonWidht,
         GameElements.ButtonHeight);
     r_ComputerRandomColorSelection = GameManger.GetRandomColor();
 }
 protected override void OnClick(EventArgs e)
 {
     GameManger.ChosenColorsInOneRound = new Color[GameElements.NumberOfButtonsInRow];
     GameManger.SetButtonsToDisable(Game.Board.GetInteractiveGameBoradButtonsInRound(r_RoundNumber));
     this.Enabled = false;
     if (Game.RoundsNumber >= r_RoundNumber + 1)
     {
         GameManger.ReportRoundResult(
             Game.Board.GetInteractiveGameBoradButtonsInRound(r_RoundNumber),
             Game.Board.GetComputerSelectionButtons(),
             r_RoundNumber);
     }
 }
 private void buttonStart_Click(object sender, EventArgs e)
 {
     this.Hide();
     this.Close();
     GameManger.PreparingToStartGame(m_NumberOfPlayerChances);
 }