private IEnumerator Request(WWW www, RequestType requestType, SubmitSuccessHandler successEvent, SubmitErrorHandler errorEvent)
{
yield return www;
GA.Log("GameAnalytics: URL " + www.url);
try
{
if (!string.IsNullOrEmpty(www.error))
{
throw new Exception(www.error);
}
//Get the JSON object from the response
string text = www.text;
text = text.Replace("null","0");
Hashtable returnParam = (Hashtable)GA_MiniJSON.JsonDecode(text);
if (returnParam != null)
{
GA.Log("GameAnalytics: Result: " + text);
if (successEvent != null)
{
successEvent(requestType, returnParam, errorEvent);
}
}
else
{
throw new Exception(text);
}
}
catch (Exception e)
{
if (errorEvent != null)
{
errorEvent(e.Message);
}
}
}