public void SetBranchText(ConversationBranch newBranch, string replacementToken)
    {
        //make panel transparent
         canvasGroup.alpha = 0;

         // shut everything off to start with
         HideAllText();

         // change dialogue font if applicable
         if (newBranch.dialogueFont != null) {
           choiceBits[0].text.font = newBranch.dialogueFont;
         }
         else {
           choiceBits[0].text.font = defaultFont;
         }

         Selectable selectable = choiceBits[0].bitRoot.GetComponent<Selectable>();
         selectable.interactable = (newBranch.dialogue.LeadsSomewhere);
         ColorBlock colors = selectable.colors;

         // if we have no choices, treat the dialogue as a big choice
         if (newBranch.choices.Length == 0) {
           choiceBits[0].bitRoot.SetActive(true);
           choiceBits[0].text.text = newBranch.dialogue.text.Replace(TalkNode.TOKEN_SIGNAL, replacementToken);

          colors.normalColor = Color.white;
          selectable.colors = colors;

         }
         else { // otherwise populate things standardly
           dialogueBit.bitRoot.SetActive(true);
           dialogueBit.text.text = newBranch.dialogue.text.Replace(TalkNode.TOKEN_SIGNAL, replacementToken);
           for (int i = 0; i < choiceBits.Length; i++) {
         if (i < newBranch.choices.Length && newBranch.choices[i].HasAllPrerequisites()) {
           choiceBits[i].bitRoot.SetActive(true);
           choiceBits[i].text.text = newBranch.choices[i].text.Replace(TalkNode.TOKEN_SIGNAL, replacementToken);

         }
           }

           colors.normalColor = defaultColor;
           selectable.colors = colors;
         }
    }
Example #2
0
 private void SetBranch(int index)
 {
     currentBranchIndex = index;
     currentBranch = conversation[currentBranchIndex];
     menuManager.SetBranchText(currentBranch, Token);
 }