Exemple #1
0
    /// <summary>
    /// Called when the Reading Tracker Updates. Microphone energy can be used to display audio input to the user.
    /// Current word index can be found in the Update Result.
    /// </summary>
    /// <param name="energy">Energy.</param>
    /// <param name="updateResult">Update result.</param>
    void SonicInterfaces.ReadingTrackerCallback.onReadingTrackerUpdate(float energy, SonicInterfaces.ReadingTrackerUpdateResult updateResult)
    {
        Debug.Log("Reading tracker update word start index: " + updateResult.wordStartIndex);

        //Debug.Log (updateResult.wordStartIndex);
        //Debug.Log ("length: " + updateResult.wordLength);

        //Text phrase = GameObject.Find("/Dialog/Canvas/"+phraseNum).GetComponentsInChildren<Text>()[0];
        //if first word, put the open tag
        if (coloredIndex < updateResult.wordStartIndex)
        {
            colorWord(updateResult.wordStartIndex, updateResult.wordLength, "yellow");

            /*
             * Debug.Log ("Coloring");
             * //if (updateResult.wordStartIndex == 0) {
             * string openTag = "<color=yellow>";
             * phraseComponent.text = phraseComponent.text.Insert (updateResult.wordStartIndex+offset, "<color=yellow>");
             * Debug.Log ("after open tag phrase: " + phraseComponent.text + " length: "+phraseComponent.text.Length);
             * offset += openTag.Length;
             * //}
             * string closeTag = "</color>";
             * Debug.Log ("index: " + updateResult.wordStartIndex + " length: " + updateResult.wordLength + " offset: " + offset);
             * phraseComponent.text = phraseComponent.text.Insert (updateResult.wordStartIndex + updateResult.wordLength + offset, closeTag);
             * offset += closeTag.Length;*/
        }
        coloredIndex = updateResult.wordStartIndex;
        //indexedLineStringDict [updateResult.wordStartIndex].color = Color.yellow;
        //mutator.washText();
        //text.text = mutator.highlight(updateResult.wordStartIndex, updateResult.wordLength, highlightColor);
    }
Exemple #2
0
    /// <summary>
    /// Called when the Reading Tracker Updates. Microphone energy can be used to display audio input to the user.
    /// Current word index can be found in the Update Result.
    /// </summary>
    /// <param name="energy">Energy.</param>
    /// <param name="updateResult">Update result.</param>
    void SonicInterfaces.ReadingTrackerCallback.onReadingTrackerUpdate(float energy, SonicInterfaces.ReadingTrackerUpdateResult updateResult)
    {
        //Debug.Log ("Update");
        //Debug.Log (updateResult.wordStartIndex);
        Debug.Log("length: " + updateResult.wordLength);

        indexedLineTextDict [updateResult.wordStartIndex].color = Color.yellow;
        //mutator.washText();
        //text.text = mutator.highlight(updateResult.wordStartIndex, updateResult.wordLength, highlightColor);
    }