예제 #1
0
    public void StartChoiceMode(Script_DialogueNode node)
    {
        if (node.data.locationType == "top")
        {
            activeCanvas  = choiceCanvasTop;
            activeChoices = choicesTop;
        }
        else
        {
            activeCanvas  = choiceCanvasBottom;
            activeChoices = choicesBottom;
        }

        // to get rid of flash at beginning and hide choice buttons
        foreach (Script_DialogueChoice choice in activeChoices)
        {
            choice.cursor.enabled = false;
            choice.gameObject.SetActive(false);
        }

        for (int i = 0; i < node.data.children.Length; i++)
        {
            activeChoices[i].Id = i;
            TextMeshProUGUI text = Script_Utils.FindComponentInChildWithTag <TextMeshProUGUI>(
                activeChoices[i].gameObject,
                Const_Tags.DialogueChoice
                );
            string unformattedText = node.data.children[i].data.choiceText;
            text.text = Script_Utils.FormatString(unformattedText);

            // show choice buttons with data
            activeChoices[i].gameObject.SetActive(true);
        }

        activeCanvas.gameObject.SetActive(true);
    }