// kinda hacky crap aaa public IEnumerator toggleChoices(ChoiceLine choiceLine, ChoiceBubble choiceBubble) { while (!ready) { InputDirection dir = Controls.getInputDirectionDown(); if (dir == InputDirection.N) { choiceLine.PreviousOption(); choiceBubble.UpdateOption(choiceLine.GetOptionIndex()); } else if (dir == InputDirection.S) { choiceLine.NextOption(); choiceBubble.UpdateOption(choiceLine.GetOptionIndex()); } yield return(null); } }
void Awake() { int choiceCount = choiceParent.Length; choiceArray = new ChoiceLine[choiceCount]; for (int i = 0; i < choiceCount; i++) { choiceArray [i] = new ChoiceLine(); choiceArray [i].title = choiceParent [i].Find("Text_Title").GetComponent <Text> (); choiceArray [i].choiceList = new List <Toggle> (); choiceArray [i].choiceTextList = new List <Text> (); for (int j = 0; j < 3; j++) { Toggle toggle = choiceParent [i].Find("Layout/Toggle" + (j + 1)).GetComponent <Toggle> (); choiceArray [i].choiceList.Add(toggle); choiceArray [i].choiceTextList.Add(toggle.transform.Find("Label").GetComponent <Text> ()); } } }
// Kinda hacked together choice system internal void DisplayChoices(ChoiceLine line, Vector3 speakerPosition, DialogueBubbleType type = DialogueBubbleType.Thought) { ready = false; List <ChoiceLineContent> choices = line.dialogueChoices; int lineNumber = choices[0].lineNumber; ChoiceBubble choiceBubble = DialogueUIController.GenerateChoiceBubblePrefab(choices.Count(), type); for (int i = 0; i < choices.Count; i++) { ChoiceLineContent content = choices[i]; choiceBubble.choicePanels[i].SetChoicePanelContent(content); } dialogueBubbles.Add(choiceBubble); DeployBubble(choiceBubble, speakerPosition); choiceBubble.UpdateOption(line.GetOptionIndex()); StartCoroutine(toggleChoices(line, choiceBubble)); StartCoroutine(animateLogs(lineNumber)); }
public static ChoiceLine GenerateChoiceLine(string speaker, List <ChoiceLineContent> choices) { ChoiceLine line = new ChoiceLine(speaker, choices); return(line); }