Пример #1
0
    private IEnumerator DoRequest( WWWFactory inWWWFactory, Action< string, WWW > inCallback )
    {
        string err = string.Empty;

        WWW www = null;

        //Debug.Log ("Do PostRequest");
        if( Application.internetReachability != NetworkReachability.NotReachable || inWWWFactory.IsLocal )
        {
            www = inWWWFactory.GetWWW( );
            yield return www;

            if( !www.isDone )
            {
                err = "Can not connect";
            }
            else
            {
                err = www.error;

                bool hasErr = !string.IsNullOrEmpty( err ) ;

                if( hasErr && err.StartsWith( "304" ) )
                {
                    err = string.Empty;
                }
            }
        }
        else
        {
            err = "No Internet Connection!";
        }

        if ( !string.IsNullOrEmpty( err ) )
        {
            Debug.Log( "Error: " +  err );
        }

        inCallback( err, www );
    }
Пример #2
0
    private IEnumerator DoRequest(WWWFactory inWWWFactory, Action <string, WWW> inCallback)
    {
        string err = string.Empty;

        WWW www = null;

        //Debug.Log ("Do PostRequest");
        if (Application.internetReachability != NetworkReachability.NotReachable || inWWWFactory.IsLocal)
        {
            www = inWWWFactory.GetWWW( );
            yield return(www);

            if (!www.isDone)
            {
                err = "Can not connect";
            }
            else
            {
                err = www.error;

                bool hasErr = !string.IsNullOrEmpty(err);

                if (hasErr && err.StartsWith("304"))
                {
                    err = string.Empty;
                }
            }
        }
        else
        {
            err = "No Internet Connection!";
        }

        if (!string.IsNullOrEmpty(err))
        {
            Debug.Log("Error: " + err);
        }

        inCallback(err, www);
    }