private void doComputerTurn() { string firstGuess; string secondGuess; GameManager.makeComputerTurn(out firstGuess, out secondGuess, m_ComputerLevel, m_BoardGame.BoardGameWithSquares); foreach (MemoryGameButton button in m_BoardGame.BoardGameWithButtons) { if (firstGuess.Equals(button.Name)) { m_FirstButtonGeuss = button; } if (secondGuess.Equals(button.Name)) { m_SecondButtonGeuss = button; } } computerClick(m_FirstButtonGeuss); Thread.Sleep(1500); computerClick(m_SecondButtonGeuss); checkIfCurrectGuess(); }
private void buttonClicked(object sender, EventArgs e) { m_CurrentButtonClickedByPlayer = sender as MemoryGameButton; if (m_HasInternetConnection) { m_CurrentButtonClickedByPlayer.BackgroundImage = m_CurrentButtonClickedByPlayer.ButtonImage; } else { m_CurrentButtonClickedByPlayer.Text = m_CurrentButtonClickedByPlayer.Square.letter.ToString(); } m_CurrentButtonClickedByPlayer.FlatStyle = FlatStyle.Flat; m_CurrentButtonClickedByPlayer.FlatAppearance.BorderColor = m_IsFirstPlayerTurn ? m_FirstPlayerScore.BackColor : m_SecondPlayerScore.BackColor; m_CurrentButtonClickedByPlayer.FlatAppearance.BorderSize = 3; m_CurrentButtonClickedByPlayer.Refresh(); m_CurrentButtonClickedByPlayer.Click -= buttonClicked; changeKnownLettersForComputer(m_CurrentButtonClickedByPlayer); m_CurrentButtonClickedByPlayer.Refresh(); if (m_IsGuessNumberOne) { m_FirstButtonGeuss = m_CurrentButtonClickedByPlayer; m_IsGuessNumberOne = !m_IsGuessNumberOne; } else { m_SecondButtonGeuss = m_CurrentButtonClickedByPlayer; checkIfCurrectGuess(); } }
private void computerClick(MemoryGameButton i_ClickedButton) { if (m_HasInternetConnection) { i_ClickedButton.BackgroundImage = i_ClickedButton.ButtonImage; } else { i_ClickedButton.Text = i_ClickedButton.Square.letter.ToString(); } i_ClickedButton.FlatStyle = FlatStyle.Flat; i_ClickedButton.FlatAppearance.BorderColor = m_SecondPlayerScore.BackColor; i_ClickedButton.FlatAppearance.BorderSize = 3; i_ClickedButton.Refresh(); changeKnownLettersForComputer(i_ClickedButton); i_ClickedButton.Refresh(); }
private void changeKnownLettersForComputer(MemoryGameButton i_ChosenButton) { GameManager.s_AvailbleMoves.Remove(i_ChosenButton.Name); GameManager.s_ManageComputerTurns.KnownLetters(i_ChosenButton.Name, m_BoardGame.BoardGameWithSquares); }