Пример #1
0
        public void CheckUserGuess(RowOfColoredCells i_UserChanceLineToCheck, ref ushort io_boolCounter, ref ushort io_PgiaCounter)
        {
            Button[] buttonsArray = i_UserChanceLineToCheck.Button;
            ushort   readIndexForButtons = 0, readIndexForColors = 0;

            foreach (Button button in buttonsArray)
            {
                foreach (Color color in m_ComputerChoice)
                {
                    if (button.BackColor.Equals(color))
                    {
                        if (readIndexForColors == readIndexForButtons)
                        {
                            io_boolCounter++;
                        }
                        else
                        {
                            io_PgiaCounter++;
                        }

                        readIndexForColors = 0;
                        break;
                    }
                    else
                    {
                        readIndexForColors++;
                    }
                }

                readIndexForButtons++;
                readIndexForColors = 0;
            }
        }
Пример #2
0
        private void setLinesOfUserChances()
        {
            m_RowOfColoredCells = new RowOfColoredCells[r_NumOfChances];

            for (int i = 0; i < r_NumOfChances; i++)
            {
                m_RowOfColoredCells[i] = new RowOfColoredCells();
            }

            m_RowOfColoredCells[0].SetButtonsLocation(m_ComputersChoice.Bottom + 20);

            for (int i = 1; i < r_NumOfChances; i++)
            {
                m_RowOfColoredCells[i].SetButtonsLocation(m_RowOfColoredCells[i - 1].Bottom + 8);
            }

            foreach (RowOfColoredCells Line in m_RowOfColoredCells)
            {
                foreach (Button button in Line.Button)
                {
                    button.Click += new EventHandler(cellClicked);
                    this.Controls.Add(button);
                    button.Show();
                }
            }
        }
Пример #3
0
 private void setComputerChoiceLine()
 {
     m_ComputersChoice = new RowOfColoredCells();
     m_ComputersChoice.SetButtonsLocation(k_NumOfButtons);
     foreach (Button button in m_ComputersChoice.Button)
     {
         button.BackColor = Color.Black;
         button.Enabled   = false;
         this.Controls.Add(button);
         button.Show();
     }
 }
Пример #4
0
        public PickAColorWindow()
        {
            this.Size            = new Size(k_PickAColorWindowWidth, k_PickAColorWindowHeight);
            this.Text            = "Pick A Color:";
            this.FormBorderStyle = FormBorderStyle.FixedToolWindow;
            this.CenterToScreen();
            m_RowOfColoredCells = new RowOfColoredCells[k_NumOfLines];

            for (int i = 0; i < k_NumOfLines; i++)
            {
                m_RowOfColoredCells[i] = new RowOfColoredCells();
            }

            m_RowOfColoredCells[0].SetButtonsLocation(8);
            m_RowOfColoredCells[1].SetButtonsLocation(m_RowOfColoredCells[0].Button[0].Bottom + k_NumOfButtonsInEachLine);
            setColorsAndShowButtons();
            this.ClientSize = new Size((m_RowOfColoredCells[0].Button[0].Width * k_NumOfButtonsInEachLine) + 30, (m_RowOfColoredCells[0].Button[0].Height * k_NumOfLines) + 20);
            this.ShowDialog();
        }