Exemple #1
0
    public void NextWord()
    {
        if ((useVoice && wordCount >= 10) || wordCount >= canto [lineCount % canto.Length].Length)
        {
            textDisplay.fullText.text += "\n";

            GUIStyle   height_calculator = new GUIStyle();
            GUIContent guiTextContent    = new GUIContent(textDisplay.fullText.text);

            float textWidth  = textDisplay.fullText.preferredWidth;
            float textHeight = height_calculator.CalcHeight(guiTextContent, textWidth);

            if (textHeight > 50)
            {
                bool delete    = true;
                int  charIndex = 0;
                while (delete)
                {
                    if (charIndex >= textDisplay.fullText.text.Length || textDisplay.fullText.text[charIndex] == '\n' || charIndex > 100)
                    {
                        if (textDisplay.fullText.text[charIndex + 1] != '\n')
                        {
                            charIndex++;
                        }
                        delete = false;
                    }
                    else
                    {
                        charIndex++;
                    }
                }
                // textDisplay.fullText.text
                textDisplay.fullText.text = textDisplay.fullText.text.Substring(charIndex, textDisplay.fullText.text.Length - charIndex);
            }

            wordCount = 0;
            lineCount++;
        }

        //if(useVoice){

        confirmedCount             = NodeServerManager.GetConfirmedWords().Length;
        textDisplay.fullText.text += NodeServerManager.GetLastConfirmedWord() + " ";

        unconfirmedCount = NodeServerManager.GetUnconfirmedWords().Length;
        textDisplay.GetComponent <Text>().text = NodeServerManager.GetLastUnconfirmedWord();
        //}else{

        //	lastWord = canto[lineCount][wordCount];
        //	textDisplay.GetComponent<Text>().text =  canto[lineCount][wordCount];
        //	textDisplay.fullText.text += canto[lineCount][wordCount] + " ";
        //}

        // textDisplay.fullText.text
        // textDisplay.GetComponent<Text>().text =  canto[lineCount][wordCount];
        //  Font curFont = fonts [Random.Range (0, fonts.Length)];
        //  newWord.GetComponent<TextMesh> ().font = curFont;
        //  curFont = fonts [Random.Range(0, fonts.Length)];
        //  if (newWord.GetComponent<TextMesh> ().font == curFont) {
        //  }
        //  newWord.GetComponent<Renderer> ().sharedMaterial = curFont.material;
        //  newWord.AddComponent<BoxCollider2D> ();
        //  newWord.GetComponent<BoxCollider2D> ().isTrigger = true;
        //  lastWord.x += newWord.GetComponent<BoxCollider2D> ().bounds.size.x + letterSpacing;
        //  if(canto[lineCount % canto.Length][wordCount].Contains(lineBreak)){
        //      newWord.transform.localScale *= 5;
        //      curFont = fonts [4];
        //      newWord.GetComponent<TextMesh> ().font = curFont;
        //      newWord.GetComponent<Renderer> ().sharedMaterial = curFont.material;
        //  }
        wordCount++;
        count++;
    }