public void GetAssetBundle(string url, EventHnadlerHTTPAssetBundle assetBuntleCallback, EventHandlerOnError errorCallback)
 {
     StartCoroutine(RunGetAssetBundleCoroutine(url, assetBuntleCallback, errorCallback));
 }
    private IEnumerator RunPostFormCoroutine(string url, WWWForm formData, EventHandlerHTTPString stringCallback, EventHandlerOnError errorCallback)
    {
        WWW www = new WWW(url, formData);

        while (!www.isDone)
        {
            yield return(null);
        }

        if (string.IsNullOrEmpty(www.error))
        {
            if (stringCallback != null)
            {
                stringCallback(www.text, www.responseHeaders);
            }
            else
            {
                Debug.Log("<Color=#4f3c3c>no request callback method.</color>");
                yield return(null);
            }
        }
        else
        {
            if (errorCallback != null)
            {
                errorCallback(www.error);
            }
        }

        if (www != null)
        {
            www.Dispose();
            www = null;
        }
    }
 public void GetTexture(string url, EventHandlerHTTPTexture textureCallback, EventHandlerOnError errorCallback)
 {
     StartCoroutine(RunGetTextureCoroutine(url, textureCallback, errorCallback));
 }
 public void GetString(string url, EventHandlerHTTPString stringCallback, EventHandlerOnError errorCallback, EventHandlerOverTime overTime = null)
 {
     StartCoroutine(RunGetStringCoroutine(url, stringCallback, errorCallback, overTime));
 }
 public void PostForm(string url, WWWForm formData, EventHandlerHTTPString stringCallback, EventHandlerOnError errorCallback)
 {
     StartCoroutine(RunPostFormCoroutine(url, formData, stringCallback, errorCallback));
 }
    private IEnumerator RunGetAssetBundleCoroutine(string url, EventHnadlerHTTPAssetBundle assetBundleCallback, EventHandlerOnError errorCallback)
    {
        WWW www = new WWW(url);

        while (!www.isDone)
        {
            yield return(null);
        }

        if (string.IsNullOrEmpty(www.error))
        {
            if (assetBundleCallback != null)
            {
                assetBundleCallback(www.assetBundle, www.responseHeaders);
            }
            else
            {
                Debug.Log("<Color=#4f3c3c>no request callback method.</color>");
                yield return(null);
            }
        }
        else
        {
            if (errorCallback != null)
            {
                errorCallback(www.error);
            }
        }

        if (www != null)
        {
            www.Dispose();
            www = null;
        }
    }
    private IEnumerator RunGetStringCoroutine(string url, EventHandlerHTTPString stringCallback, EventHandlerOnError errorCallback, EventHandlerOverTime overTime = null)
    {
        WWW www = new WWW(url);

        while (!www.isDone)
        {
            yield return(null);

            if (overTime != null && CheckTimeOut(www) && !GlobalValues.IsDownloadOverTime)
            {
                GlobalValues.IsDownloadOverTime = true;
                overTime("progress" + www.progress);
            }
        }

        if (string.IsNullOrEmpty(www.error))
        {
            if (stringCallback != null)
            {
                stringCallback(www.text, www.responseHeaders);
            }
            else
            {
                Debug.Log("no request Log Error");
                yield return(null);
            }
        }
        else
        {
            if (errorCallback != null)
            {
                errorCallback(www.error);
            }
        }

        if (www != null)
        {
            www.Dispose();
            www = null;
        }
    }