IEnumerator IEGetAccount(System.Action <RecordAccount> callback) { using (WWW www = new WWW("http://localhost:8080/getaccount")) { yield return(www); RecordAccount account = JsonConvert.DeserializeObject <RecordAccount>(www.text); Debug.Log(account != null ? account.ToString() : "NULL"); callback(account); } }
IEnumerator IEDeletePet(string pet_id, System.Action <RecordAccount> callback) { byte[] bytes = System.Text.Encoding.UTF8.GetBytes(pet_id); using (WWW www = new WWW("http://localhost:8080/deletepet", bytes)) { yield return(www); RecordAccount account = JsonConvert.DeserializeObject <RecordAccount>(www.text); Debug.Log(account != null ? account.ToString() : "NULL"); callback(account); } }
IEnumerator IECreatePet(System.Action <RecordAccount> callback) { using (WWW www = new WWW("http://localhost:8080/createpet", new byte[] { 1 })) { yield return(www); Debug.Log(www.error); Debug.Log(www.text); RecordAccount account = JsonConvert.DeserializeObject <RecordAccount>(www.text); Debug.Log(account != null ? account.ToString() : "NULL"); callback(account); } }