示例#1
0
    private void ShowNextWord()
    {
        CancelInvoke("ShowNextWord");

        TextContainer currentTextContainer = textContainers[currentTextMeshIndex];

        if (currentTextContainer.CanDisplayNextWord())
        {
            currentTextContainer.AppendNextWord();
            DispatchMessage("OnShowNextWord", null);
            Invoke("ShowNextWord", textTimeout);
        }
        else
        {
            if (currentTextMeshIndex < textContainers.Count - 1)
            {
                currentTextMeshIndex++;
                currentTextContainer = textContainers[currentTextMeshIndex];
                Invoke("ShowNextWord", textTimeout);
                return;
            }

            DispatchMessage("OnTextDone", this);
            return;
        }
    }
    protected virtual void ShowNextWord()
    {
        CancelInvoke("ShowNextWord");

        TextContainer currentTextContainer = textContainers[currentTextMeshIndex];

        if (currentTextContainer.CanDisplayNextWord())
        {
            PlayTalkingAnimation();

            currentTextContainer.AppendNextWord();
            DispatchMessage("OnShowNextWord", null);

            if (textTimeout != -1f)
            {
                Invoke("ShowNextWord", textTimeout);
            }
        }
        else
        {
            if (currentTextMeshIndex < textContainers.Count - 1)
            {
                currentTextMeshIndex++;
                currentTextContainer = textContainers[currentTextMeshIndex];
                Invoke("ShowNextWord", textTimeout);
                return;
            }

            OnTextBoxDone();
            DispatchMessage("OnTextDone", this);
            return;
        }
    }