public void DrawAnswerButtons(QuestsController.QuestNode node) { int answersCount = node.answers.Count; int indexInHierarchy = 0; for (int childIndex = 0; childIndex < answersCount; childIndex++) { QuestsController.Answer answer = node.answers [childIndex]; if (!quest.settings.showUnavailableAnswers.value) { if (!QuestsController.IsPassRequirements(answer)) { continue; } } GameObject button = GenerateAnswerButton(answer.text, answer.imageName, indexInHierarchy); indexInHierarchy += 1; EventDelegate action = new EventDelegate(this, "SelectAnswer"); action.parameters[0].value = answer; EventDelegate.Add(button.GetComponent <UIButton>().onClick, action); if (quest.settings.showUnavailableAnswers.value) { if (!QuestsController.IsPassRequirements(answer)) { Destroy(button.GetComponent <BoxCollider>()); } } } answerButtonsGrid.GetComponent <UIGrid>().Reposition(); }
public void SelectAnswer(QuestsController.Answer answer) { DialogueSystem.reference.log.Add(new string[] { AITextLabel.text, AISprite.spriteName, answer.text }); DialogueSystem.reference.currentLogIndex += 1; QuestsController.ApplyResults(answer); QuestsController.QuestNode nextNode = QuestsController.FindNode(quest, answer.pointer); if (nextNode == null) { DialogueSystem.reference.FinishQuest(); return; } currentNode = nextNode; PrepareNodeInfo(currentNode); UpdateUI(); }