private IEnumerator UserLoginCoroutine(string user, string password, SimpleDelegate <MeridianData.UserLoginResult> userLoginDelegate) { // Build json by hand string jsonString = "{ mail:'" + user + "', password:'******' }"; WWW www = MeridianCommunications.POST("/Catalog/Login", jsonString); yield return(www); MeridianData.UserLoginResult result = null; if (www.error == null) { // Since JSon comes in the form of an array we must wrap data around a class. result = JsonUtility.FromJson <MeridianData.UserLoginResult>("{\"userList\":" + www.text + "}"); } else { } if (userLoginDelegate != null) { userLoginDelegate(result); } }
private IEnumerator RegisterUserCoroutine(string token, string admin, string user, string email, string password, SimpleDelegate <MeridianData.RegisterUserResult> registerUserDelegate) { // Build json by hand string jsonString = "{" + string.Format("lEmail:\"{0}\", lToken:\"{1}\", Nombre:\"{2}\", Email:\"{3}\", Password:\"{4}\"", admin, token, user, email, password) + "}"; WWW www = MeridianCommunications.POST("/Catalog/RegistrarUsuario", jsonString); yield return(www); MeridianData.RegisterUserResult result = null; if (www.error == null) { // Since JSon comes in the fom of an array we must wrap data around a class. result = JsonUtility.FromJson <MeridianData.RegisterUserResult>("{\"registerUserList\":" + www.text + "}"); } else { Debug.Log(www.error); } if (registerUserDelegate != null) { registerUserDelegate(result); } }
private IEnumerator GetStoreCoroutine(int id, SimpleDelegate <MeridianData.Store> getStoreDelegate) { WWW www = MeridianCommunications.GET("/Catalog/Get/Sucursal/0/ID/" + id); yield return(www); MeridianData.Stores stores = null; if (www.error == null) { // Since JSon comes in the fom of an array we must wrap data around a class. stores = JsonUtility.FromJson <MeridianData.Stores>("{\"storeList\":" + www.text + "}"); } else { Debug.Log(www.error); } if (getStoreDelegate != null) { getStoreDelegate(stores.storeList[0]); } }
private void OnEnable() { StartCoroutine(MeridianCommunications.CheckInternetConnection(InternetOk, NoInternet)); }