Exemplo n.º 1
0
    IEnumerator ReqeustSignIn()
    {
        List <IMultipartFormSection> formData = new List <IMultipartFormSection>();

        formData.Add(new MultipartFormDataSection("username", id));
        formData.Add(new MultipartFormDataSection("input_password", pw));

        UnityWebRequest webRequest = UnityWebRequest.Post("http://52.78.94.149:80/api/v1/users/signin/", formData);

        yield return(webRequest.SendWebRequest());

        if (webRequest.isNetworkError || webRequest.isHttpError)
        {
            Debug.Log(webRequest.error);
            // pop up??
        }
        else
        {
            Debug.Log("Form upload complete!");
            string result = webRequest.downloadHandler.text;
            Debug.Log("Response: " + result);
            ResData d = JsonUtility.FromJson <ResData>(result);

            string user_pk   = d.id;
            string user_id   = d.username;
            string user_name = d.name;

            sm         = playerStatus.GetComponent <StatusManagerStart>();
            sm.user_pk = user_pk;
            sm.Call();
        }
    }
Exemplo n.º 2
0
    public void ChangeSceneToGameForTest()
    {
        // sm = GameObject.Find("StatusManagerStart").GetComponent<StatusManagerStart>();
        sm = playerStatus.GetComponent <StatusManagerStart>();
        Debug.Log("heh");
        string user_pk = "1";

        sm.user_pk = user_pk;
        sm.Call();
        //SceneManager.LoadScene("GameScene");
    }