private void BindChoices(Choice[] choices, string key, int triggerID) { int buttonCount = choices.Length; if (buttonCount > existingButton) { GenerateButtons(buttonCount - existingButton); } for (int i = 0; i < buttonCount; i++) { int choiceNumber = i; Conversation c = choices[i].nextConversation; buttonText[i].text = choices[i].text; buttonTransforms[i].offsetMax = buttonText[i].GetPreferredValues(choices[i].text) * new Vector2(0.7f, 1) + new Vector2(10, 0); buttonTransforms[i].offsetMin = -buttonText[i].GetPreferredValues(choices[i].text) * new Vector2(0.7f, 1) - new Vector2(10, 0); buttons[i].onClick.RemoveAllListeners(); buttons[i].onClick.AddListener(() => { ResetButtons(buttonCount); ChoiceTracker.Track(key, choiceNumber); DialogueManager.instance.SetupChoiceEvent(choiceNumber); DialogueManager.instance.LoadConversation(c, triggerID); }); } ArrangeButtons(buttonCount); }
public void Track(int choice) { ChoiceTracker.Track(key, choice); }