Пример #1
0
        //Open Homonyms lesson form
        private void picHomonyms_Click(object sender, EventArgs e)
        {
            HomonymsLesson HomonymsLesson = new HomonymsLesson();

            HomonymsLesson.wordLevelsForm = this;
            HomonymsLesson.mainLevelsForm = this.mainLevelsForm;
            HomonymsLesson.Show();

            this.Hide();
        }
Пример #2
0
        //Check your answer function
        private void btnCheckYourAnswer_Click(object sender, EventArgs e)
        {
            hideFeedBack();



            if (comboBox1.Text.Trim() == "" || comboBox2.Text.Trim() == "" || comboBox3.Text.Trim() == "" || comboBox4.Text.Trim() == "" || comboBox5.Text.Trim() == "")
            {
                showFeedBack("Please answer all the five questions first", Color.Red);
            }
            else if (btnCheckYourAnswer.Text == "Restart the level")
            {
                S_A_Load(sender, e);
            }
            else if (btnCheckYourAnswer.Text == "Go to Homonyms lesson")
            {
                HomonymsLesson HomonymsLesson = new HomonymsLesson();
                HomonymsLesson.mainLevelsForm = this.mainLevelsForm;
                HomonymsLesson.wordLevelsForm = this.wordLevelsForm;
                this.Hide();
                wordLevelsForm.lblhelp.Text = "You successfully unlocked all the levels";
                HomonymsLesson.Show();
            }
            else
            {
                attempt--;
                lblAttempts.Text = attempt.ToString();

                //Correct answer (fq: first question)
                if (fq == false && comboBox1.Text.Trim().ToLower().Contains(lblAns1.Text.Trim().ToLower()))
                {
                    picAns1.BackgroundImage = Properties.Resources.check;
                    points++;
                    btnHint1.Enabled  = false;
                    comboBox1.Enabled = false;
                    Questions--;
                    fq = true;
                }//incorrect answer
                else if (fq == false && !comboBox1.Text.Trim().ToLower().Contains(lblAns1.Text.Trim().ToLower()))
                {
                    picAns1.BackgroundImage = Properties.Resources.cross;
                }



                if (sq == false && comboBox2.Text.Trim().ToLower().Contains(lblAns2.Text.Trim().ToLower()))
                {
                    picAns2.BackgroundImage = Properties.Resources.check;
                    points++;
                    btnHint2.Enabled  = false;
                    comboBox2.Enabled = false;
                    Questions--;
                    sq = true;
                }
                else if (sq == false && !comboBox2.Text.Trim().ToLower().Contains(lblAns2.Text.Trim().ToLower()))
                {
                    picAns2.BackgroundImage = Properties.Resources.cross;
                }



                if (tq == false && comboBox3.Text.Trim().ToLower().Contains(lblAns3.Text.Trim().ToLower()))
                {
                    picAns3.BackgroundImage = Properties.Resources.check;
                    points++;
                    btnHint3.Enabled  = false;
                    comboBox3.Enabled = false;
                    Questions--;
                    tq = true;
                }
                else if (tq == false && !comboBox3.Text.Trim().ToLower().Contains(lblAns3.Text.Trim().ToLower()))
                {
                    picAns3.BackgroundImage = Properties.Resources.cross;
                }



                if (foq == false && comboBox4.Text.Trim().ToLower().Contains(lblAns4.Text.Trim().ToLower()))
                {
                    picAns4.BackgroundImage = Properties.Resources.check;
                    points++;
                    btnHint4.Enabled  = false;
                    comboBox4.Enabled = false;
                    Questions--;
                    foq = true;
                }
                else if (foq == false && !comboBox4.Text.Trim().ToLower().Contains(lblAns4.Text.Trim().ToLower()))
                {
                    picAns4.BackgroundImage = Properties.Resources.cross;
                }



                if (fiq == false && comboBox5.Text.Trim().ToLower().Contains(lblAns5.Text.Trim().ToLower()))
                {
                    picAns5.BackgroundImage = Properties.Resources.check;
                    points++;
                    btnHint5.Enabled  = false;
                    comboBox5.Enabled = false;
                    Questions--;
                    fiq = true;
                }
                else if (fiq == false && !comboBox5.Text.Trim().ToLower().Contains(lblAns5.Text.Trim().ToLower()))
                {
                    picAns5.BackgroundImage = Properties.Resources.cross;
                }


                /*if (Questions == 0)
                 * {
                 *  showFeedBack("Good job, keep up the good work in the next level.", Color.Green);
                 *
                 *  lblPoints.Text = (attempt + 1 + hints + points).ToString();
                 *
                 *  SavePoints();
                 *  btnCheckYourAnswer.Text = "Go to Homonyms lesson";
                 *
                 *  this.wordLevelsForm.picHomonyms.Enabled = true;
                 *  this.wordLevelsForm.picHomonymsLock.Visible = false;
                 *  wordLevelsForm.lblhelp.Text = "You successfully unlocked all the levels.";
                 *
                 * }
                 */

                //solved 3 or more questions
                if ((Questions <= 2 && attempt == 0) || (Questions == 0))
                {
                    showFeedBack("Good job, keep up the good work in the next level.", Color.Green);

                    lblPoints.Text = (attempt + 1 + hints + points).ToString();

                    SavePoints();
                    btnCheckYourAnswer.Text = "Go to Homonyms lesson";

                    this.wordLevelsForm.picHomonyms.Enabled     = true;
                    this.wordLevelsForm.picHomonymsLock.Visible = false;
                    wordLevelsForm.lblhelp.Text = "You successfully unlocked all the levels.";
                }


                if (attempt > 0 && Questions > 0)
                {
                    if (attempt == 4)
                    {
                        showFeedBack("Try again you still have four attempts left.", Color.Red);
                    }
                    else if (attempt == 3)
                    {
                        showFeedBack("Try again you still have three attempts left.", Color.Red);
                    }
                    else if (attempt == 2)
                    {
                        showFeedBack("Try again you still have two attempts left", Color.Red);
                    }
                    else if (attempt == 1)
                    {
                        showFeedBack("Try again you still have one attempt left", Color.Red);
                    }
                }


                //no more attempts and we still have 3 or more incorrect questions
                if (attempt == 0 && Questions >= 3)
                {
                    lblHint.Visible = false;


                    showFeedBack("Sorry, you need to answer at least three questions to pass this level", Color.Red);

                    btnCheckYourAnswer.Text = "Restart the level";
                }


                if (attempt == 0 && Questions > 0)
                {
                    lblCorrectAns.Text = "";

                    if (fq == false)
                    {
                        lblCorrectAns.Visible = true;
                        lblCorrectAns.Text    = "The correct answer for the first question is " + lblAns1.Text;
                    }
                    if (sq == false)
                    {
                        lblCorrectAns.Visible = true;
                        lblCorrectAns.Text    = lblCorrectAns.Text + "\nThe correct answer for the second question is " + lblAns2.Text;
                    }
                    if (tq == false)
                    {
                        lblCorrectAns.Visible = true;
                        lblCorrectAns.Text    = lblCorrectAns.Text + "\nThe correct answer for the third question is " + lblAns3.Text;
                    }
                    if (foq == false)
                    {
                        lblCorrectAns.Visible = true;
                        lblCorrectAns.Text    = lblCorrectAns.Text + "\nThe correct answer for the fourth question is " + lblAns4.Text;
                    }
                    if (fiq == false)
                    {
                        lblCorrectAns.Visible = true;
                        lblCorrectAns.Text    = lblCorrectAns.Text + "\nThe correct answer for the fifth question is " + lblAns5.Text;
                    }
                }
            }
        }