public void SignUpButton() { fresherUser fresher = new fresherUser(); fresher.Name = name.text; fresher.Email = email.text; fresher.Programme = GameManager.me.currentlySelectedProgramme; fresher.School = GameManager.me.School; string output = JsonConvert.SerializeObject(fresher); Dictionary<string, string> headers = new Dictionary<string, string>(); headers.Add("Content-type", "application/json"); byte[] pData = Encoding.ASCII.GetBytes(output.ToCharArray()); WWW www = new WWW(registerUserURl, pData, headers); StartCoroutine(RegisterUserCoroutine(www)); }
public void SignUpButton() { fresherUser fresher = new fresherUser(); fresher.Name = name.text; fresher.Email = email.text; fresher.Programme = GameManager.me.currentlySelectedProgramme; fresher.School = GameManager.me.School; string output = JsonConvert.SerializeObject(fresher); Dictionary <string, string> headers = new Dictionary <string, string>(); headers.Add("Content-type", "application/json"); byte[] pData = Encoding.ASCII.GetBytes(output.ToCharArray()); WWW www = new WWW(registerUserURl, pData, headers); StartCoroutine(RegisterUserCoroutine(www)); }
IEnumerator LogInUserCoroutine(WWW www) { yield return(www); if (www.error == null) { Debug.Log(www.text); fresherUser jsonUser = JsonConvert.DeserializeObject <fresherUser>(www.text); GameManager.me.userId = jsonUser.Id; completedChallenges.GetCompletedChallenges(); // loggedInMenus.SetActive(true); GetUserInfo(); } else { Debug.Log(www.error); } }
IEnumerator GetUserInfoCoroutine(WWW www) { yield return(www); if (www.error == null) { fresherUser user = JsonConvert.DeserializeObject <fresherUser>(www.text); GameManager.me.School = user.School; loggedOutMenus.SetActive(false); if (GameManager.me.onTutorial < 1) { GameManager.me.tutorial.SetActive(true); } else { GameManager.me.freshersChallenges.SetActive(true); loggedInMenus.SetActive(true); } } }