예제 #1
0
        public void purchaseArrows()
        {
            Sound s1 = new Sound();
            //call trivia class and ask two questions and return if they got
            //at least 2 or more correct
            int numRight = 0;
            int numQ     = 0;

            while (numRight < 2 && numQ < 3)
            {
                this.gold--;
                Console.WriteLine(questions.askQuestion());
                Console.WriteLine("Pick an Option (A, B, C, or D):");
                String input = Console.ReadLine();
                input.ToLower();
                if (questions.checkAnswer(input))
                {
                    Console.WriteLine("Correct!");
                    numRight++;
                    s1.correct();
                }
                else
                {
                    Console.WriteLine("Incorrect!");
                    s1.incorrect();
                }
                numQ++;
            }
            if (numRight > 2)
            {
                Console.WriteLine("Awesome! You got " + numRight +
                                  "questions right, giving you 2 extra arrows!");
                this.arrows = this.arrows + 2;
                updateScore();
            }
            else
            {
                Console.WriteLine("Sorry, you got " + numRight +
                                  "questios right out of the required two. You did not recieve extra arrows...");
            }
        }
예제 #2
0
 private void Confirm_Click(object sender, EventArgs e)
 {
     if (questions.checkAnswer(this.answer))
     {
         this.correct++;
         MessageBox.Show("Correct!");
         triviaSound.correct();
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else if (this.answer.Equals("a") || this.answer.Equals("b") || this.answer.Equals("c") || this.answer.Equals("d"))
     {
         MessageBox.Show("Wrong!");
         triviaSound.incorrect();
         this.DialogResult = DialogResult.OK;
         this.Close();
     }
     else
     {
         MessageBox.Show("Not a valid input. Please try again");
     }
 }