Beispiel #1
0
        private IEnumerator Begin()
        {
            var parser    = new ASSParser(subtitleFile);
            var startTime = Time.time;

            while (true)
            {
                var elasped = Time.time - startTime;

                int substringIndex = 0;
                var subtitle       = parser.GetForTime(elasped, out substringIndex);

                if (subtitle != null)
                {
                    string modifiedString = subtitle.Text;
                    modifiedString = modifiedString.Insert(substringIndex, highlightEndTag);
                    modifiedString = modifiedString.Insert(0, highlightStartTag);
                    text.text      = modifiedString;
                }
                else
                {
                    if (onComplete != null)
                    {
                        onComplete.Invoke();
                    }

                    yield break;
                }

                yield return(null);
            }
        }
Beispiel #2
0
        }        //End Method

        private IEnumerator BeginNoGUIMode()
        {
            var parser    = new ASSParser(subtitleFile);
            var startTime = Time.time;

            while (true)
            {
                var elasped = Time.time - startTime;

                int substringIndex = 0;
                var subtitle       = parser.GetForTime(elasped, out substringIndex);

                if (subtitle != null)
                {
                    this._myFinalString = subtitle.Text;

                    // This part adds the Highlight to the Karaoke Lyrics:
                    // End (</Color>) Tag:
                    //
                    _myFinalString = _myFinalString.Insert(substringIndex, highlightEndTag);
                    //
                    // Add the Start Color TAG = <Color=Red>
                    //
                    _myFinalString = _myFinalString.Insert(0, highlightStartTag);
                    //
                    // Add the Complete String to the UI-Text Component (we could use a TextMeshPro UI-Text here):
                    //
                    /// Original code: This IS THE LINE that makes the difference here:  text.text = _myFinalString;
                    //
                    // AlMartson (i.e.: Alejandro Almarza): I will add my two cents here:
                    // CHECK whether we are passing throught the Start of An Animated-Important Phrase:
                    //
                    //int index = -1;
                    //index = modifiedString.IndexOf(@_FRASE_2_TRIVIA_KARAOKE /*@_FRASE_1_TRIVIA_KARAOKE*/ );
                    ////
                    //if (index >= 0)       // int index = str.IndexOf(@"\");
                    //{
                    //   ///Debug.LogWarning("\n\n" + _FRASE_1_TRIVIA_KARAOKE);

                    //}//End if


                    BuscarFraseParaTrivia(_myFinalString);
                }
                else    // We are done. End of Song / Video.
                {
                    if (onComplete != null)
                    {
                        onComplete.Invoke();
                    }

                    yield break;
                }

                yield return(null);
            } //ENd while
        }     //End Method