Exemplo n.º 1
0
    private void processSpecialSection(bool skip = false)
    {
        string actStr      = "";
        char   nextChar    = RawText.ToCharArray() [m_lastCharacterIndex];
        int    numSpecials = 1;

        while (numSpecials > 0 && m_lastCharacterIndex < RawText.Length - 1)
        {
            actStr += nextChar;
            m_lastCharacterIndex++;
            nextChar = RawText.ToCharArray() [m_lastCharacterIndex];
            if (nextChar == '>')
            {
                numSpecials--;
            }
            else if (nextChar == '<')
            {
                numSpecials++;
            }
        }
        List <DialogueAction> executedActions = TextboxManager.ValidActions(actStr);
        string retStr = "";

        foreach (DialogueAction da in executedActions)
        {
            if (skip)
            {
                retStr += da.SkipAction(actStr, this);
            }
            else
            {
                retStr += da.PerformAction(actStr, this);
            }
        }
        m_lastCharacterIndex++;
        m_processedText = m_processedText.Substring(0, m_lastCharacterIndex) + retStr + m_processedText.Substring(m_lastCharacterIndex);
    }
Exemplo n.º 2
0
    private string ParseSpecialSection(string section)
    {
        string actStr   = "";
        int    charNum  = 0;
        char   nextChar = section.ToCharArray() [charNum];

        actStr += nextChar;
        int    numSpecials = 1;
        string retString   = "";

        while (numSpecials > 0 && charNum < section.Length - 1)
        {
            charNum++;
            nextChar = section.ToCharArray() [charNum];
            if (nextChar == '>')
            {
                numSpecials--;
                continue;
            }
            else if (nextChar == '<')
            {
                numSpecials++;
                continue;
            }
            actStr += nextChar;
        }

        List <DialogueAction> executedActions = TextboxManager.ValidActions(actStr);

        foreach (DialogueAction da in executedActions)
        {
            retString += da.PerformAction(actStr, this);
        }
        charNum++;
        return(retString + section.Substring(charNum));
    }