public IEnumerator Displaytext()
    {
        while (true)
        {
            yield return(new WaitForSeconds(.1f));

            try{
                index++;
                index = index % displayText.Length;
                string temp  = displayText.Substring(index);
                string temp2 = displayText.Substring(0, index);

                int id = temp2.LastIndexOf(" ");
                if (id == -1)
                {
                    id = 0;
                }
                int id2 = temp.IndexOf(" ");
                if (id2 == -1)
                {
                    if (temp.IndexOf(".") != -1)
                    {
                        id2 = temp.IndexOf(".");
                    }
                    else
                    {
                        id2 = temp.Length - 1;
                    }
                }
                string added = temp2.Substring(id) + temp.Substring(0, id2 + 1);
                string rel   = (GetWordsAndPhonics.GetPhonics(added));
                if (added != lastWord && rel != "")
                {
                    phonics.text = rel.Trim();
                    ImageDisplayer.AddToQueue(PhonicDecoder.GetImages(GetWordsAndPhonics.GetPhonics(added)));
                }
                lastWord = added;
                DisplayCurrentString();
            }catch (Exception ex) { }
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     id = this;
     StartCoroutine(Loop());
 }
示例#3
0
 public void SetDisplayer(ImageDisplayer NewDisplayer)
 {
     Displayer = NewDisplayer;
 }