示例#1
0
 public GameForm(GameButtons i_gameButtons, Board i_board)
 {
     this.m_Board     = i_board;
     m_GameButtons    = i_gameButtons;
     m_SequenceColors = new List <Button>();
     sequenceColorButtonGenerator();
     for (int i = 0; i < m_GameButtons.m_GameRows.Count; i++)
     {
         m_GameButtons.m_GameRows[i].ColorsGenerated = m_Board.colorSequence;
         this.Controls.Add(m_GameButtons.m_GameRows[i].m_PointerToAccuracy);
         for (int j = 0; j < 4; j++)
         {
             if (i == 0)
             {
                 this.Controls.Add(m_GameButtons.m_GameRows[i].m_GuessButtons[j]); // to enable only the first row of guesses
                 this.Controls.Add(m_GameButtons.m_GameRows[i].m_ResultButtons[j]);
             }
             else
             {
                 m_GameButtons.m_GameRows[i].m_GuessButtons[j].Enabled = false;  //disable all rows that are not 0
                 this.Controls.Add(m_GameButtons.m_GameRows[i].m_GuessButtons[j]);
                 this.Controls.Add(m_GameButtons.m_GameRows[i].m_ResultButtons[j]);
             }
         }
     }
     InitializeComponent();
 }
示例#2
0
        private void startButton_Click(object sender, EventArgs e)
        {
            Board          board = new Board(numberOfChances);
            List <GameRow> Rows  = new List <GameRow>();

            for (int i = 0; i < board.NumRows; i++)
            {
                GameRow row = new GameRow((82 + 52 * i), i);
                Rows.Add(row);
            }
            GameButtons gameButtons = new GameButtons(Rows);
            GameForm    gameForm    = new GameForm(gameButtons, board);

            foreach (GameRow row in gameForm.m_GameButtons.m_GameRows)
            {
                row.m_Game     = gameButtons;
                row.m_GameForm = gameForm;
            }
            gameForm.Owner = this;
            this.Hide();
            gameForm.ShowDialog();
        }