Beispiel #1
0
    public void getButtonPressed(int i)
    {
        lastButton = i;
        string responseSelected = currentResponses[i];

        //print("pressing button " + i);
        //print(responseSelected);
        print(findNode(responseSelected).ToString());
        dialogueNode node = findNode(responseSelected);

        currentSpeaker   = node.getSpeaker();
        currentText      = node.getText();
        currentResponses = node.getResponses().ToList();
        updateScreen();
    }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        lines = responses.text.Split('\n').ToList();
        foreach (string line in lines)
        {
            string[] currentLine = line.Split('|');
            if (currentLine.Length == 3)
            {
                dialogueNode test = new dialogueNode(nodes.Count, currentLine[0], currentLine[1], currentLine[2]);
                nodes.Add(test);
                if (speakers.Contains(currentLine[0]) == false)
                {
                    speakers.Add(currentLine[0]);
                }
            }
            else
            {
                throw new FormatException('"' + line + '"' + " is not formatted correctly");
            }
        }
        foreach (string speaker in speakers)
        {
            SpritePair current = new SpritePair(speaker, null);
            spritePairs.Add(current);
        }
        for (int i = 0; i < nodes.Count; i++)
        {
            foreach (int j in nodes[i].getResponseIndices())
            {
                nodes[i].updateDict(j, nodes[j].getText());
            }
            //print(nodes[i].ToString());
        }
        currentSpeaker = nodes[0].getSpeaker();
        currentText    = nodes[0].getText();

        currentResponses = nodes[0].getResponses().ToList();
        updateScreen();
    }