public void OnDeleteButtonClicked()
    {
        using (UnityWebRequest httpClient = new UnityWebRequest(httpServer + "/api/Player/Delete?id=" + player.Id, "POST"))
        {
            httpClient.certificateHandler = new ByPassCertificate();
            httpClient.SendWebRequest();
            while (!httpClient.isDone)
            {
                Task.Delay(1);
            }
            if (httpClient.isNetworkError || httpClient.isHttpError)
            {
                //throw new Exception("OnRegisterButtonClick: Network Error");
                Debug.Log(httpClient.isNetworkError);
                Debug.Log(httpClient.isHttpError);
                Debug.Log(httpClient.error);
            }

            Debug.Log(httpClient.responseCode);

            httpClient.Dispose();
        }
        using (UnityWebRequest httpClient = new UnityWebRequest(httpServer + "/api/Account/Delete?id=" + player.Id, "POST"))
        {
            httpClient.certificateHandler = new ByPassCertificate();
            httpClient.SetRequestHeader("Authorization", "bearer " + gameManager.Token);
            httpClient.SendWebRequest();
            while (!httpClient.isDone)
            {
                Task.Delay(1);
            }
            if (httpClient.isNetworkError || httpClient.isHttpError)
            {
                //throw new Exception("OnRegisterButtonClick: Network Error");
                Debug.Log(httpClient.isNetworkError);
                Debug.Log(httpClient.isHttpError);
                Debug.Log(httpClient.error);
            }

            Debug.Log(httpClient.responseCode);

            httpClient.Dispose();
        }

        gameManager.LogOutPlayer();
        SceneManager.LoadScene(0);
    }
Exemple #2
0
 public void OnLogOutButtonClicked()
 {
     UpdateState("0", player.Id);
     gameManager.LogOutPlayer();
     SceneManager.LoadScene(0);
 }