public void GetData(OnDataRecievedCallback onDataRecieved) { if (IsLoggedIn) { //ready to send request StartCoroutine(sendGetDataRequest(LoggedIn_Username, LoggedIn_Password, onDataRecieved)); //calls function to send get data request } }
public void GetData(OnDataRecievedCallback onDataRecieved) { //called when the 'Get Data' button on the data part is pressed if (IsLoggedIn) { //ready to send request StartCoroutine(sendGetDataRequest(PlayerUsername, PlayerPassword, onDataRecieved)); //calls function to send get data request } }
IEnumerator sendGetDataRequest(string username, string password, OnDataRecievedCallback onDataRecieved) { string data = "ERROR"; IEnumerator eeee = DCF.GetUserData(username, password); while (eeee.MoveNext()) { yield return(eeee.Current); } //WWW returnedddd = eeee.Current as WWW; string response = eeee.Current as string; // << The returned string from the request if (response == "Error") { //Error occurred. For more information of the error, DC.Login could //be used with the same username and password Debug.Log("Data Upload Error. Could be a server error. To check try again, if problem still occurs, contact us."); } else { if (response == "ContainsUnsupportedSymbol") { //One of the parameters contained a - symbol Debug.Log("Get Data Error: Contains Unsupported Symbol '-'"); } else { //Data received in returned.text variable string DataRecieved = response; data = DataRecieved; } } //LoggedIn_Data = data; if (onDataRecieved != null) { onDataRecieved.Invoke(data); } }