public void SetupUIForQuestion(Text _category, QuizQuestion question) { RemoveAnswersIcons(); ToggleAnswerButtons(true); jokersPanel.SetActive(true); categoryText.text = _category.text; questionText.text = question.Question; questionText.fontSize = uiCommon.FixFontSizeForQuestion(questionText.text.Length); _currentCorrectAnswer = question.CorrectAnswer[0]; //Binaire répartition indicesBinary = uiCommon.ChooseRandomIndices(2); answerButtonsBinaire[indicesBinary[0]].GetComponentInChildren <Text>().text = _currentCorrectAnswer; answerButtonsBinaire[indicesBinary[1]].GetComponentInChildren <Text>().text = question.WrongAnswers[Random.Range(0, 3)]; //Tetra répartition indicesTetra = uiCommon.ChooseRandomIndices(4); int[] indicesWrongAnswers = uiCommon.ChooseRandomIndices(3); answerButtonsTetra[indicesTetra[0]].GetComponentInChildren <Text>().text = question.CorrectAnswer[0]; answerButtonsTetra[indicesTetra[1]].GetComponentInChildren <Text>().text = question.WrongAnswers[indicesWrongAnswers[0]]; answerButtonsTetra[indicesTetra[2]].GetComponentInChildren <Text>().text = question.WrongAnswers[indicesWrongAnswers[1]]; answerButtonsTetra[indicesTetra[3]].GetComponentInChildren <Text>().text = question.WrongAnswers[indicesWrongAnswers[2]]; for (int i = 0; i < answerButtonsBinaire.Length; i++) { answerButtonsBinaire[i].GetComponentInChildren <Text>().fontSize = uiCommon.FixFontSizeForAnswers(answerButtonsBinaire[i].GetComponentInChildren <Text>().text.Length); } for (int i = 0; i < answerButtonsTetra.Length; i++) { answerButtonsTetra[i].GetComponentInChildren <Text>().fontSize = uiCommon.FixFontSizeForAnswers(answerButtonsTetra[i].GetComponentInChildren <Text>().text.Length); } }
public void SetupUIForQuestion(Text _category, QuizQuestion question) { progressionQuestions.transform.GetChild(GameManager.Instance.CurrentQuestionFinale - 1).GetComponent <Image>().color = new Color(0.6f, 0.6f, 0.6f); binairePanel.SetActive(false); tetraPanel.SetActive(false); cashCashPanel.SetActive(false); answerChoicePanel.SetActive(true); ToggleAnswerButtons(true); categoryText.text = _category.text; questionText.text = question.Question; questionText.fontSize = uiCommon.FixFontSizeForQuestion(questionText.text.Length); CurrentCorrectAnswer = question.CorrectAnswer[0]; //Binaire répartition int[] indicesBinaire = uiCommon.ChooseRandomIndices(2); answerButtonsBinaire[indicesBinaire[0]].GetComponentInChildren <Text>().text = question.CorrectAnswer[0]; answerButtonsBinaire[indicesBinaire[1]].GetComponentInChildren <Text>().text = question.WrongAnswers[UnityEngine.Random.Range(0, 3)]; //Tetra répartition int[] indicesTetra = uiCommon.ChooseRandomIndices(4); int[] indicesWrongAnswers = uiCommon.ChooseRandomIndices(3); answerButtonsTetra[indicesTetra[0]].GetComponentInChildren <Text>().text = question.CorrectAnswer[0]; answerButtonsTetra[indicesTetra[1]].GetComponentInChildren <Text>().text = question.WrongAnswers[indicesWrongAnswers[0]]; answerButtonsTetra[indicesTetra[2]].GetComponentInChildren <Text>().text = question.WrongAnswers[indicesWrongAnswers[1]]; answerButtonsTetra[indicesTetra[3]].GetComponentInChildren <Text>().text = question.WrongAnswers[indicesWrongAnswers[2]]; for (int i = 0; i < answerButtonsBinaire.Length; i++) { answerButtonsBinaire[i].GetComponentInChildren <Text>().fontSize = uiCommon.FixFontSizeForAnswers(answerButtonsBinaire[i].GetComponentInChildren <Text>().text.Length); } for (int i = 0; i < answerButtonsTetra.Length; i++) { answerButtonsTetra[i].GetComponentInChildren <Text>().fontSize = uiCommon.FixFontSizeForAnswers(answerButtonsTetra[i].GetComponentInChildren <Text>().text.Length); } }