示例#1
0
    // Load All Phonics from dictionary
    void Start()
    {
        string path = "Assets/Resources/Words_Phonics/entries.txt";

        StreamReader reader = new StreamReader(path, Encoding.UTF8);

        string[] lines = reader.ReadToEnd().Split('\n');
        foreach (var item in lines)
        {
            string[] split = item.Split(' ', '\t');
            if (!store.ContainsKey(split[0]))
            {
                store[split[0]] = split[2];
            }
        }
        curret = this;
    }
    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) { }
        }
    }