Beispiel #1
0
    protected void Awake()
    {
        qaController = this;

        GameData.Load();
        QuestionData.Load("Xml/QnA");

        usedQuestions = new List <QuestionData.question>();

        QuestionData.current.EmitQuestionsMap(out questionsMap);
    }
Beispiel #2
0
    //Call this when you want a new question for the second activity
    public bool NewQuestionForTheSecondActivity(ref string the_question, int the_score)
    {
        if (questionDataForSecondActivity == null)
        {
            //the path to the XML file with the data about the questions
            questionDataForSecondActivity = QuestionData.Load(Path.Combine
                                                                  (Application.dataPath, "questionDataForSecondActivity.xml"));
        }

        if ((question_index_for_second + 1) <= questionDataForSecondActivity.questions.Count)
        {
            //get a question
            currentQuestion = questionDataForSecondActivity.questions[question_index_for_second];

            the_question = correct_answer_from_previous_question + "\nQuestion: " + currentQuestion.questionText +
                           " \n\nPossible answers: " + currentQuestion.answer1 +
                           "     " + currentQuestion.answer2
                           + "     " + currentQuestion.answer3 + "     " + currentQuestion.answer4 + "     " + currentQuestion.answer5
                           + "     " + currentQuestion.answer6 + "     " + currentQuestion.answer7 + "     " + currentQuestion.answer8
                           + "     " + currentQuestion.answer9 + "     " + currentQuestion.answer10 + "        :-> "
                           + currentQuestion.correctAnswer + "\n\nQuestion " + (question_index_for_second + 1) + " out of "
                           + questionDataForSecondActivity.questions.Count + "; current score:" + the_score + "\n\n";
        }

        if ((question_index_for_second + 1) <= questionDataForSecondActivity.questions.Count)
        {//still continue with this activity
            question_index_for_second++;
            return(false);
        }

        /*else if ((question_index + 1) == questionDataForFirstActivity.questions.Count)
         * {//still continue with this activity
         *  return false;
         * }*/
        else if ((question_index_for_second + 1) > questionDataForSecondActivity.questions.Count)
        {//new activity
            return(true);
        }
        else//new activity
        {
            return(true);
        }
    }
Beispiel #3
0
 internal void ShowResult(string file)
 {
     this.ShowResult(QuestionData.Load(file));
 }
Beispiel #4
0
    // Call this when you want a new question for the first activity
    public bool NewQuestionForTheFirstActivity(ref string the_question, ref Dropdown Dropdown_Menu, int the_score)
    {
        if (questionDataForFirstActivity == null)
        {
            //the path to the XML file with the data about the questions
            questionDataForFirstActivity = QuestionData.Load(Path.Combine
                                                                 (Application.dataPath, "questionDataForFirstActivity.xml"));
        }

        // gets a random question
        //int q = Random.Range(0, questionDataForFirstActivity.questions.Count);

        if ((question_index + 1) <= questionDataForFirstActivity.questions.Count)
        {
            //get a question
            currentQuestion = questionDataForFirstActivity.questions[question_index];

            // add code here to set text values of your Question GameObject
            // e.g. GetComponent<SomeScript>().Text = currentQuestion.questionText;
            the_question = correct_answer_from_previous_question + "Question " + (question_index + 1) + " out of "
                           + questionDataForFirstActivity.questions.Count + "; current core:" + the_score +
                           "\n\n" + currentQuestion.questionText + "\n\n";

            /* +" \n\nChoices: " + currentQuestion.answer1 +
             *  "     "+currentQuestion.answer2
             + "     " + currentQuestion.answer3 + "     " + currentQuestion.answer4 + "     " + currentQuestion.answer5
             + "     " +currentQuestion.answer6 + "     " + currentQuestion.answer7 + "     " + currentQuestion.answer8
             + "     " +currentQuestion.answer9 + "     " + currentQuestion.answer10 + "\n\n"+": "
             + currentQuestion.correctAnswer+"\n";*/

            //Dropdown_Menu.Select();
            //clear the choices in the dropdown and add the answers

            /*Dropdown_Menu.options.Clear();
             * Dropdown_Menu.value = 0;
             * Dropdown_Menu.captionText = null;*/

            Dropdown_Menu.value = 0;
            Dropdown_Menu.options.Clear();

            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = "Make your choice!"
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer1
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer2
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer3
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer4
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer5
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer6
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer7
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer8
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer9
            });
            Dropdown_Menu.options.Add(new Dropdown.OptionData()
            {
                text = currentQuestion.answer10
            });
            //Dropdown_Menu.captionText = Dropdown_Menu.captionText;
        }

        if ((question_index + 1) <= questionDataForFirstActivity.questions.Count)
        {//still continue with this activity
            question_index++;
            return(false);
        }

        /*else if ((question_index + 1) == questionDataForFirstActivity.questions.Count)
         * {//still continue with this activity
         *  return false;
         * }*/
        else if ((question_index + 1) > questionDataForFirstActivity.questions.Count)
        {//new activity
            return(true);
        }
        else//new activity
        {
            return(true);
        }
    }