IEnumerator Post(string url, string bodyJsonString)
    {
        var request = new UnityWebRequest(url, "POST");

        byte[] bodyRaw = Encoding.UTF8.GetBytes(bodyJsonString);
        request.uploadHandler   = (UploadHandler) new UploadHandlerRaw(bodyRaw);
        request.downloadHandler = (DownloadHandler) new DownloadHandlerBuffer();
        request.SetRequestHeader("Content-Type", "application/json");

        yield return(request.Send());

        Debug.Log("Status Code: " + request.responseCode);
        // error.text = request.responseCode.ToString();
        if (request.responseCode == 200)
        {
            CurrntUI.SetActive(false);
            TargetUI.SetActive(true);
            Email.text = "";
            pass.text  = "";
            User.text  = "";
            Cpass.text = "";
        }
        if (request.responseCode != 200)
        {
            errorText.SetActive(true);
            error.text = "Something Went Wrong";
        }
    }
Example #2
0
 void Start()
 {
     if (PlayerPrefs.GetString("Login") == "Login")
     {
         CurrntUI.SetActive(false);
         TargetUI.SetActive(true);
     }
 }
Example #3
0
    public void OnSubmit()
    {
        logdata user = new logdata();

        //user.username = User.text;
        //  user.passward = pass.text;
        // jsonString = JsonUtility.ToJson(user);

        CurrntUI.SetActive(false);
        TargetUI.SetActive(true);
        Debug.Log(usernane);
        Debug.Log(passWard);
        jsonString = "{ \"password\": \"" + pass.text + "\", \"username\": \"" + User.text + "\"}";
        Debug.Log(jsonString);
        StartCoroutine(Post(url, jsonString));
    }
Example #4
0
 public void Translate()
 {
     TargetUI.SetActive(true);
     CurrntUI.SetActive(false);
 }