Esempio n. 1
0
    public static IEnumerator RetrieveData(string path, RetrieveDataCallback callback)
    {
        string file = Directory.GetFiles(path)[0];

        Debug.Log("file: "+file);

        string data = File.ReadAllText(file);

        yield return true;

        callback(data);
    }
Esempio n. 2
0
    public static IEnumerator RetrieveData(string url, WWWForm postForm = null,RetrieveDataCallback callback = null)
    {
        WWW w;

        if (postForm != null)
            w = new WWW(url, postForm);
        else
            w = new WWW(url);

        yield return w;

        if(!string.IsNullOrEmpty(w.error)){
            Debug.Log(w.error);
            callback("error");
        }
        else{
            callback(w.text);
        }
    }