private void GnerateAnsers() { ClearPrevAnswers(); int index = 0; foreach (var answer in _question.Answers) { if (answer == null) { continue; } GameObject uiObj = Instantiate(answerPrefab, transform); AnswerUI answerUi = uiObj.GetComponent <AnswerUI>(); answerUi.Init(index, answer.Text); answerUi.apearDelay = index * .3f; answerUi.OnPeacked += OnAnswePeacked; index++; if (answer.Tag.Length > 0) { ExecutePramsAnswer pramsAnswer = new ExecutePramsAnswer(); pramsAnswer.state = StateTag.OnShow; pramsAnswer.answer = answer; pramsAnswer.ui = answerUi; tagParser.ParseTag(answer.Tag, pramsAnswer); } } }
public Question PeackAnswer(int index) { if (index >= _currentQuestion.Answers.Length) { return(null); } Answer ans = _currentQuestion.Answers[index]; if (ans.Tag.Length > 0) { ExecutePramsAnswer pramsAnswer = new ExecutePramsAnswer(); pramsAnswer.state = StateTag.OnPicked; pramsAnswer.answer = ans; pramsAnswer.ui = null; tagParser.ParseTag(ans.Tag, pramsAnswer); } _currentQuestion = ans.Question; if (_currentQuestion != null) { OnQuestionChangedChanged?.Invoke(_currentQuestion); } return(_currentQuestion); }