Пример #1
0
    public void ClickAnswerButton(bool isTrue)    //call by answer button themselves
    {
        if (isTrue)
        {
            userScore += currRData.marksForTrueAnswer;

            showScoreText.text     = "Score: " + userScore.ToString();
            showSameScoreText.text = "Score: " + userScore.ToString() + "/20";


            if (userScore > PlayerPrefs.GetInt("highScore", 0))
            {
                PlayerPrefs.SetInt("highScore", userScore);
                showHighScore.text = userScore.ToString();
            }
        }

        else
        {
            QuestionQuizL1E1 questionData = qPool[qIndex];
            for (int i = 0; i < questionData.answer.Length; i++)
            {
                AnswerQuizL1E1 ansData = questionData.answer[i];
                if (ansData.isTrue)
                {
                    Debug.Log(ansData.answerT);
                    //    ColorBlock colours = GetComponent<AButton>()
                    //  colours.normalColor = Color.red;
                    //GetComponent<Button>().colors = colours;
                }
            }
        }


        if (qNumber < qPool.Length - 1)
        {
            qNumber++;
            DisplayQuestions();
        }
        else
        {
            EndRound();
        }
    }
Пример #2
0
 public void SetAnsButton(AnswerQuizL1E1 data)
 {
     ansData      = data;
     answerT.text = ansData.answerT;
 }