Ejemplo n.º 1
0
        public void Reset()
        {
            lblAns4.Visible   = true;
            btnSub4.Visible   = true;
            btnAdd4.Visible   = true;
            lblTrap4.Visible  = true;
            btnClear4.Visible = true;
            btnMax4.Visible   = true;
            lblAns3.Visible   = true;
            btnSub3.Visible   = true;
            btnAdd3.Visible   = true;
            lblTrap3.Visible  = true;
            btnClear3.Visible = true;
            btnMax3.Visible   = true;
            lblRound.Text     = 0.ToString();
            lblMoney.Text     = 1000000.ToString();
            LamData database = new LamData();

            AllQuestions = database.getAllQuestions();
            Round();
        }
Ejemplo n.º 2
0
        public void Round()
        {
            Money = int.Parse(lblMoney.Text);
            if (Money != 0)
            {
                LamData  database = new LamData();
                Question ask;
                CurrentRound = int.Parse(lblRound.Text);
                CurrentRound++;
                lblRound.Text = CurrentRound.ToString();

                switch (CurrentRound)
                {
                case 1:
                case 2:
                case 3:
                case 4:
                    ask          = database.getSingleQuestion(AllQuestions, 4);
                    lblQue.Text  = ask.Question1.ToString();
                    lblAns1.Text = ask.Answer1.ToString();
                    lblAns2.Text = ask.Answer2.ToString();
                    lblAns3.Text = ask.Answer3.ToString();
                    lblAns4.Text = ask.Answer4.ToString();
                    Correct      = ask.Correct;
                    database.usedQuestion(AllQuestions, ask);
                    break;

                case 5:
                case 6:
                case 7:
                    DisableElement(4);
                    ask          = database.getSingleQuestion(AllQuestions, 3);
                    lblQue.Text  = ask.Question1.ToString();
                    lblAns1.Text = ask.Answer1.ToString();
                    lblAns2.Text = ask.Answer2.ToString();
                    lblAns3.Text = ask.Answer3.ToString();
                    Correct      = ask.Correct;
                    database.usedQuestion(AllQuestions, ask);
                    break;

                case 8:
                    DisableElement(3);
                    ask          = database.getSingleQuestion(AllQuestions, 2);
                    lblQue.Text  = ask.Question1.ToString();
                    lblAns1.Text = ask.Answer1.ToString();
                    lblAns2.Text = ask.Answer2.ToString();
                    Correct      = ask.Correct;
                    database.usedQuestion(AllQuestions, ask);
                    break;

                case 9:
                    MessageBox.Show("You won:  " + Money, "GG");
                    Visible = false;
                    break;
                }
            }
            else
            {
                Visible = false;
                DialogResult dialogResult = MessageBox.Show("Do you want start a new game?", "You lose a milion. Congrats!", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    Reset();
                    Visible = true;
                }
            }
        }