Exemple #1
0
    public void RestartSequence()
    {
        var du = new DialogueUnit {
            Previous = Previous, elements = elements
        };

        du.startSequence();
    }
Exemple #2
0
    public void AdvanceSequence()
    {
        DialogueUnit currDialogueUnit = allDUnits [0];

        currDialogueUnit.Speaker = Speaker;
        currDialogueUnit.startSequence();
        allDUnits.Remove(currDialogueUnit);
    }
Exemple #3
0
    public void CloseSequence()
    {
        DialogueUnit first = null;

        if (allDUnits.Count > 0)
        {
            first = allDUnits [0];
        }
        allDUnits.Clear();
        if (first != null)
        {
            first.closeSequence();
        }
    }
Exemple #4
0
    private void SetDialogue(DialogueUnit unit)
    {
        currentUnit = unit;
        if (unit.kind == DialogueKind.Talk)
        {
            talkPanel.SetActive(true);
            monoPanel.SetActive(false);
            soundPanel.SetActive(false);

            photoImage.sprite = unit.cg;
            if (photoImage.sprite == null)
            {
                Color tempColor = photoImage.color;
                tempColor.a      = 0;
                photoImage.color = tempColor;
            }
            else
            {
                Color tempColor = photoImage.color;
                tempColor.a      = 1;
                photoImage.color = tempColor;
            }
            TypingCor = StartCoroutine(TypeContent(unit.content));
        }
        else if (unit.kind == DialogueKind.Sound)
        {
            talkPanel.SetActive(false);
            monoPanel.SetActive(false);
            soundPanel.SetActive(true);

            soundText.text = unit.content;
            Invoke("GoNext", 2);
        }
        else if (unit.kind == DialogueKind.Mono)
        {
            talkPanel.SetActive(false);
            monoPanel.SetActive(true);
            soundPanel.SetActive(false);

            StartCoroutine(MonoContent(unit.content));
        }
    }
Exemple #5
0
    public DialogueSequence parseSequence(string text, int startingChar = 0, int indLevel = 0, DialogueSequence parentSeq = null)
    {
        DialogueSequence newSeq = new DialogueSequence();

        newSeq.parentSequence = parentSeq;
        List <DialogueUnit> subDS = new List <DialogueUnit> ();

        DialogueUnit du = new DialogueUnit {
        };

        subDS.Add(du);
        string lastText             = "";
        string lastAnim             = "none";
        int    i                    = startingChar;
        bool   full                 = false;
        int    specialSequenceDepth = 0;

        while (i < text.Length)
        {
            char lastC = text.ToCharArray() [i];
            newSeq.rawText += lastC;
            du.RawText     += lastC;
            if (lastC == '<')
            {
                specialSequenceDepth++;
            }
            else if (lastC == '>')
            {
                specialSequenceDepth--;
            }
            if (lastText.Length == 0 && lastC == ' ')
            {
            }
            else if (lastText.Length == 0 && lastC == '-')
            {
                DialogueSequence newS = parseSequence(text, i, indLevel + 1, newSeq);
                i += newS.numChars;
            }
            else if (lastC == '~')
            {
                full = true;
            }
            else if (specialSequenceDepth == 0 && (lastC == '\n' || lastC == '|'))
            {
                if (lastText.Length > 0)
                {
                    if (lastAnim == "none")
                    {
                        du.addTextbox(lastText, full);
                    }
                    else
                    {
                        du.addTextbox(lastText, lastAnim, full);
                    }
                    full = false;
                }
                lastText = "";
            }
            else
            {
                lastText += lastC;
            }
            newSeq.numChars += 1;
            i += 1;
        }
        if (lastAnim == "none")
        {
            du.addTextbox(lastText, full);
        }
        else
        {
            du.addTextbox(lastText, lastAnim, full);
        }
        subDS.Add(du);
        newSeq.allDUnits = subDS;
        return(newSeq);
    }