Пример #1
0
    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());
        }
    }
Пример #2
0
 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));
     }
 }
Пример #3
0
 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));
     }
 }
Пример #4
0
    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));
        }
    }