public IEnumerator LoginToServer(string username, string password) { WWWForm formData = new WWWForm(); formData.AddField("QueryType", "loginuser"); formData.AddField("Username", username); formData.AddField("Password", password); UnityWebRequest www = UnityWebRequest.Post("http://avcmediasystems.ro/test/gameyfire/GameyFire_ServerService.php", formData); www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.Send()); if (!www.isError) { JSONDataClass jsonTxt = JSON_UtilityClass.DecodeJSON(www.downloadHandler.text); UserDataClass.UserID = JSON_UtilityClass.ParseIntFromString(jsonTxt.id); UserDataClass.FirstName = jsonTxt.FirstName; UserDataClass.LastName = jsonTxt.LastName; UserDataClass.Username = jsonTxt.Username; UserDataClass.Usermail = jsonTxt.Mail; UserDataClass.Password = jsonTxt.Password; //StartCoroutine(DownloadPersonaListFromServer()); } }
public void InitPersonaListFromJSONArray(List <JSONDataClass> jsonArray) { if (jsonArray.Count > 0) { ClearUserPersonaList(); } foreach (JSONDataClass tempJson in jsonArray) { UserDataClass.UserPersonas.Add(CreatePersona(JSON_UtilityClass.ParseIntFromString(tempJson.id), tempJson.PersonaName, tempJson.PersonaDesc)); } }
public void InitSkillListFromJSONArray(List <JSONDataClass> jsonArray) { if (jsonArray.Count > 0) { ClearPersonaSkillList(); } foreach (JSONDataClass tempJson in jsonArray) { PersonaDataClass.PersonaSkills.Add(CreateSkill(JSON_UtilityClass.ParseIntFromString(tempJson.id), tempJson.SkillName, tempJson.SkillRating)); } }
private IEnumerator DownloadPersonaListFromServer() { WWWForm formData = new WWWForm(); formData.AddField("QueryType", "getpersonadata"); formData.AddField("UserID", UserDataClass.UserID); UnityWebRequest www = UnityWebRequest.Post("http://avcmediasystems.ro/test/gameyfire/GameyFire_ServerService.php", formData); www.downloadHandler = new DownloadHandlerBuffer(); yield return(www.Send()); if (!www.isError) { PersonaManager.Instance.InitPersonaListFromJSONArray(JSON_UtilityClass.DecodeJSONArray(www.downloadHandler.text)); } }