コード例 #1
0
    void GetQuestionFromList()
    {
        T.start = true;

        System.Random R = new System.Random();

        int i = -1;

        while (i == -1 || DisplayedQuestions.Contains(i) || i >= Questions.Length)
        {
            if (DisplayedQuestions.Count >= Questions.Length)
            {
                Debug.Log("All Translate Selected");
                AllQAnswered = true;
                return;
            }
            i = R.Next(Questions.Length);
        }
        DisplayedQuestions.Add(i);

        Translate_Q_Class Q = new Translate_Q_Class(Questions[i].Question, Questions[i].CorrectAnswer);

        TextQuestion.Text = Q.Question;
        TextCorrectAnswer.GetComponent <Text>().text = Q.CorrectAnswer;
        CurrentQuestion = Q;
        SoundController.PlaySoundQuestion();
    }
コード例 #2
0
    void AnswerDisplay(bool Correct)
    {
        Speak(CurrentQuestion.CorrectAnswer);
        if (Correct)
        {
            Score += 10;
            SoundController.PlaySoundCorrect();
            //for Full Game Controller
            if (!IsMainController)
            {
                GameControllerScript.Score += 10;
            }
            HeaderPanel.GetComponent <Image>().color = CorrectColor;
            TextHeaderPanel.Text = CorrectText;
        }
        else
        {
            SoundController.PlaySoundWrong();
            HeaderPanel.GetComponent <Image>().color = WrongColor;
            TextHeaderPanel.Text = WrongText;
            TextTitle.SetActive(true);
            TextCorrectAnswer.SetActive(true);
        }
        ButtonAnswer.transform.GetChild(0).GetComponent <ArabicText>().Text = NewButtonText;
        TextAnswer.readOnly = true;

        ChangeStars();
    }
コード例 #3
0
 void NextQuestion()
 {
     SpeakBTN.color = SpeakOldColor;
     HeaderPanel.GetComponent <Image>().color = OldHeaderPanelColor;
     TextHeaderPanel.Text = OldTextHeaderPanel;
     ButtonAnswer.transform.GetChild(0).GetComponent <ArabicText>().Text = OldButtonText;
     TextAnswer.text     = "";
     TextAnswer.readOnly = false;
     ButtonAnswer.SetActive(false);
     TextTitle.SetActive(false);
     TextCorrectAnswer.SetActive(false);
     GetQuestionFromList();
 }