コード例 #1
0
    private TextContainerWord[] SplitWordsAndLetters()
    {
        List <TextContainerWord> allWordsOfSentenses = new List <TextContainerWord>();

        string[] localWords = textMesh.text.Trim().Split(' ');

        for (int i = 0; i < localWords.Length; i++)
        {
            string currentWord = localWords[i];

            for (int j = 0; j < currentWord.Length; j++)
            {
                TextContainerWord tcw = new TextContainerWord();
                tcw.text = currentWord[j].ToString();
                if (j == currentWord.Length - 1)
                {
                    tcw.isEndOfWord = true;
                }

                allWordsOfSentenses.Add(tcw);
            }
        }

        return(allWordsOfSentenses.ToArray());
    }
コード例 #2
0
    private TextContainerWord[] SplitWords()
    {
        string[]            wordsAsStrings = textMesh.text.Trim().Split(' ');
        TextContainerWord[] allWords       = new TextContainerWord[wordsAsStrings.Length];

        for (int i = 0; i < wordsAsStrings.Length; i++)
        {
            TextContainerWord tcw = new TextContainerWord();
            tcw.text    = wordsAsStrings[i];
            allWords[i] = tcw;
        }

        return(allWords);
    }
コード例 #3
0
    public void AppendNextWord()
    {
        TextContainerWord nextWord = words[currentWordIndex];

        if (hasSplitLetters)
        {
            textMesh.text += nextWord.text + (nextWord.isEndOfWord ? " " : "");
        }
        else
        {
            textMesh.text += nextWord.text + " ";
        }

        currentWordIndex++;
    }