void NextQuestion() { SpeakBTN.color = SpeakOldColor; HeaderPanel.GetComponent <Image>().color = OldHeaderPanelColor; TextHeaderPanel.Text = OldTextHeaderPanel; ButtonAnswer.transform.GetChild(0).GetComponent <ArabicText>().Text = OldButtonText; ButtonAnswer.SetActive(false); PanelQuestion.transform.GetChild(1).gameObject.SetActive(true); PanelQuestion.SetActive(true); PanelWrongAnswer.SetActive(false); foreach (Transform item in PanelQuestion.transform) { foreach (Transform item2 in item) { foreach (Transform item3 in item2) { Destroy(item3.gameObject); } } } if (PanelWrongAnswer.transform.GetChild(1).childCount > 0) { Destroy(PanelWrongAnswer.transform.GetChild(1).GetChild(1).gameObject); } if (PanelWrongAnswer.transform.GetChild(1).childCount > 0) { Destroy(PanelWrongAnswer.transform.GetChild(1).GetChild(0).gameObject); } GetQuestionFromList(); }
//Correct = 1, Semi = 0, Wrong = -1; void AnswerDisplay(int Correct, string CorrectAnswer) { Speak(CorrectAnswer); switch (Correct) { case 1: Score += 10; SoundController.PlaySoundCorrect(); //for Full Game Controller if (!IsMainController) { GameControllerScript.Score += 10; } HeaderPanel.GetComponent <Image>().color = CorrectColor; TextHeaderPanel.Text = CorrectText; foreach (Transform item in PanelQuestion.transform.GetChild(0)) { foreach (Transform Txt in item) { Txt.gameObject.GetComponent <Image>().color = CorrectColor; Txt.gameObject.GetComponent <Button>().interactable = false; } } PanelQuestion.transform.GetChild(1).gameObject.SetActive(false); break; case 0: Score += 5; //for Full Game Controller if (!IsMainController) { GameControllerScript.Score += 5; } HeaderPanel.GetComponent <Image>().color = SemiColor; TextHeaderPanel.Text = SemiText; string[] Lst = CorrectAnswer.Trim().Split(' '); if (CurrentQuestion.AnswerIsArabic) { Array.Reverse(Lst); } int i = 0; foreach (Transform item in PanelQuestion.transform.GetChild(0)) { foreach (Transform Txt in item) { if (Txt.transform.GetChild(0).gameObject.GetComponent <ArabicText>().Text == Lst[i]) { Txt.gameObject.GetComponent <Image>().color = CorrectColor; } else { Txt.gameObject.GetComponent <Image>().color = SemiColor; print(Txt.transform.GetChild(0).gameObject.GetComponent <ArabicText>().Text + " " + Lst[i]); } Txt.gameObject.GetComponent <Button>().interactable = false; i++; } } i = 0; Instantiate(PanelQuestion.transform.GetChild(0).GetChild(0), PanelWrongAnswer.transform.GetChild(1)); Instantiate(PanelQuestion.transform.GetChild(0).GetChild(1), PanelWrongAnswer.transform.GetChild(1)); PanelQuestion.SetActive(false); PanelWrongAnswer.SetActive(true); PanelWrongAnswer.transform.GetChild(0).GetChild(0).GetComponent <ArabicText>().Text = CorrectAnswer; break; case -1: SoundController.PlaySoundWrong(); HeaderPanel.GetComponent <Image>().color = WrongColor; TextHeaderPanel.Text = WrongText; foreach (Transform item in PanelQuestion.transform.GetChild(0)) { foreach (Transform Txt in item) { Txt.gameObject.GetComponent <Image>().color = WrongColor; Txt.gameObject.GetComponent <Button>().interactable = false; } } Instantiate(PanelQuestion.transform.GetChild(0).GetChild(0), PanelWrongAnswer.transform.GetChild(1)); Instantiate(PanelQuestion.transform.GetChild(0).GetChild(1), PanelWrongAnswer.transform.GetChild(1)); PanelQuestion.SetActive(false); PanelWrongAnswer.SetActive(true); PanelWrongAnswer.transform.GetChild(0).GetChild(0).GetComponent <ArabicText>().Text = CorrectAnswer; break; } ButtonAnswer.transform.GetChild(0).GetComponent <ArabicText>().Text = NewButtonText; ChangeStars(); }