Esempio n. 1
0
        private void submitButton_Click(object sender, EventArgs e)
        {
            Color[] colors          = getUserGuess();
            int[]   colorsInNumbers = ColorForm.convertColorsToNumbers(colors, k_NumOfColors);
            int[]   resultsOfGuess  = m_GameLogic.CalcResults(colorsInNumbers);

            int k = 0;

            for (int i = 0; i < resultsOfGuess[0]; i++)
            {
                m_ResultsOfGuess[k].BackColor = Color.Black;
                k++;
            }
            for (int i = 0; i < resultsOfGuess[1]; i++)
            {
                m_ResultsOfGuess[k].BackColor = Color.Yellow;
                k++;
            }
            m_GameLogic.CurrentGuess++;

            if (m_GameLogic.IsFinished)
            {
                revealFirstRow();
            }
            else
            {
                m_EnableNextRow.Invoke(m_GameLogic.CurrentGuess);
            }
            DisablePickColorButtons();
            m_SubmitGuess.Enabled = false;
        }
Esempio n. 2
0
 internal void Reveal()
 {
     int[]   hiddenComputerColors = m_GameLogic.GetComputerColors;
     Color[] computerGuess        = ColorForm.ConvertNumbersToColors(hiddenComputerColors, k_NumOfColors);
     for (int i = 0; i < computerGuess.Length; i++)
     {
         m_HiddenButtons[i].BackColor = computerGuess[i];
     }
 }