示例#1
0
    IEnumerator recuperar()
    {
        transform.GetComponent <ViewsManager> ().showPopUpNoAnim(2);
        transform.GetComponent <ViewsManager> ().popUps [2].GetComponent <LoadingManager> ().startSpinning();

        Dictionary <string, string> headers = new Dictionary <string, string> ();

        headers.Add("Content-Type", "application/json");
        headers.Add("Cookie", "Interceramic");
        headers.Add("pEmail", correoRecupera.text);
        headers.Add("Authorization", "Bearer " + token.Token);

        print("correoRecupera: " + correoRecupera.text);

        WWW www = new WWW(urlSesion, null, headers);

        yield return(www);

        print("Respuesta recuperar: " + www.text);
        lIR = JsonUtility.FromJson <LogIn.LogInResp> (www.text);

        if (lIR.RESULTADO == "OK")
        {
            recuperarSuccess();
        }
        else if (lIR.ERROR == "EL USUARIO NO EXISTE VERIFIQUE USUARIO")
        {
            recuperarNotSuccess("El correo no existe");
        }

        transform.GetComponent <ViewsManager> ().popUps [2].GetComponent <LoadingManager> ().stopSpinning();
        transform.GetComponent <ViewsManager> ().hidePopUpNoAnim(2);
    }
示例#2
0
    IEnumerator postAPICallback(IResult result)
    {
        print(result.ResultDictionary["email"]);
        print(result.ResultDictionary["first_name"]);
        print(result.ResultDictionary["last_name"]);

        PlayerPrefs.SetString("UserName", result.ResultDictionary["first_name"].ToString() + " " + (result.ResultDictionary["last_name"]).ToString());

        LogIn.LogInResp resp = new LogIn.LogInResp();

        string jsonData = "{\n    \"email\" : \"" + result.ResultDictionary["email"] + "\",\n    \"password\" : \"\",\n    \"claveApp\" : \"" + claveApp + "\",\n    \"macAddress\" : \"123456\",\n    \"dispositivo\" : \"celular\",\n    \"login_facebook\" : 1,\n    \"sistOperativo\" : \"IOS\"\n}\n";
        Dictionary <string, string> headers = new Dictionary <string, string> ();

        headers.Add("Content-Type", "application/json");
        headers.Add("Cookie", "Interceramic");
        headers.Add("Authorization", "Bearer " + token.Token);

        byte[] pData = Encoding.ASCII.GetBytes(jsonData.ToCharArray());

        print("JSON FB: " + jsonData);

        WWW www = new WWW(urlSesion, pData, headers);

        yield return(www);

        print("respuesta FB: " + www.text);
        resp = JsonUtility.FromJson <LogIn.LogInResp> (www.text);

        if (resp.RESULTADO == "OK")
        {
            transform.GetComponent <LogIn> ().logInSuccess();
        }
        else
        {
            transform.GetComponent <ViewsManager> ().goToIndex(1, "izquierda");

            transform.GetComponent <Registrar> ().Nombre.text             = result.ResultDictionary["first_name"] as string;
            transform.GetComponent <Registrar> ().Apellido.text           = result.ResultDictionary["last_name"] as string;
            transform.GetComponent <Registrar> ().Correo.text             = result.ResultDictionary["email"] as string;
            transform.GetComponent <Registrar> ().Contraseña.interactable = false;
            transform.GetComponent <Registrar> ().Contraseña.text         = "";

            transform.GetComponent <Registrar> ().Facebook = 1;
        }
    }