示例#1
0
    IEnumerator LoadWordData()
    {
        //string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "words.txt");
        string folder1  = System.IO.Path.Combine("searchWordGame", "searchStreamingAssets");
        string folder   = System.IO.Path.Combine(folder1, "new_words.txt");
        string filePath = System.IO.Path.Combine(Application.dataPath, folder);

        Debug.Log(filePath);

        string result = null;

        if (filePath.Contains("://"))
        {
            WWW www = new WWW(filePath);
            yield return(www);

            result = www.text;
        }
        else
        {
            result = System.IO.File.ReadAllText(filePath);
        }

        ProcessWordSource(result);


        //filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "commonWords.txt");
        folder1  = System.IO.Path.Combine("searchWordGame", "searchStreamingAssets");
        folder   = System.IO.Path.Combine(folder1, "new_words.txt");
        filePath = System.IO.Path.Combine(Application.dataPath, folder);

        result = null;

        if (filePath.Contains("://"))
        {
            WWW www = new WWW(filePath);
            yield return(www);

            result = www.text;
        }
        else
        {
            result = System.IO.File.ReadAllText(filePath);
        }


        ProcessWordData(result);

        game.InitGame();
    }
示例#2
0
    IEnumerator LoadWordData()
    {
        string filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "words.txt");

        string result = null;

        if (filePath.Contains("://"))
        {
            UnityWebRequest www = new UnityWebRequest(filePath);
            yield return(www);

            //result = www.text;
            result = www.url;
        }
        else
        {
            result = System.IO.File.ReadAllText(filePath);
        }

        ProcessWordSource(result);


        filePath = System.IO.Path.Combine(Application.streamingAssetsPath, "commonWords.txt");

        result = null;

        if (filePath.Contains("://"))
        {
            UnityWebRequest www = new UnityWebRequest(filePath);
            yield return(www);

            //result = www.text;
            result = www.url;
        }
        else
        {
            result = System.IO.File.ReadAllText(filePath);
        }


        ProcessWordData(result);

        game.InitGame();
    }