Beispiel #1
0
        private void createRounds(int i_NumberOfRounds)
        {
            int currentLeft = k_FrameDistance;
            int currentTop  = k_TopOfFirstRound;

            for (int i = 0; i < i_NumberOfRounds; i++)
            {
                RoundUI newRound = new RoundUI(currentTop, currentLeft);
                r_Rounds.Add(newRound);
                addButtonsToControls(newRound.Buttons);
                newRound.CheckGuessClicked += checkGuessButton_Click;
                currentTop += UserGuessButton.ButtonSize + k_RoundsDistance;
            }
            r_Rounds[0].IsActive = true;
            ClientSize           = new Size(r_Rounds[0].Right, currentTop);
        }
Beispiel #2
0
        private void checkGuessButton_Click(object sender, EventArgs e)
        {
            RoundUI round = sender as RoundUI;

            if (round.AllButtonsAreColored())
            {
                if (round.HasNoDuplicates())
                {
                    round.RoundLogic = r_GameLogic.Play(round.GetStringValue());
                    r_Rounds[m_ActiveRound].IsActive = false;
                    activateNextRound();
                }
                else
                {
                    MessageBox.Show("No color duplicates are allowed, select unique colors and try again.");
                }
            }
        }