void RefreshView() { if (story.canContinue) { HideChoices(); text.gameObject.SetActive(true); string rawText = story.Continue().Trim(); text.text = ParseContent(rawText); } else if (story.currentChoices.Count > 0) { ChangeSpeaker("Lucy"); HideContent(); for (int i = 0; i < Mathf.Min(story.currentChoices.Count, buttons.Length); i++) { InkCreateButton button = buttons[i]; Choice choice = story.currentChoices[i]; button.gameObject.SetActive(true); button.text.text = choice.text; button.button.onClick.AddListener(delegate { OnClickChoiceButton(choice); }); } waitingOnInput = true; } }
public void OnClickChoiceButton(Choice choice) { for (int i = 0; i < Mathf.Min(story.currentChoices.Count, buttons.Length); i++) { InkCreateButton button = buttons[i]; button.button.onClick.RemoveAllListeners(); } waitingOnInput = false; story.ChooseChoiceIndex(choice.index); RefreshView(); }