private static void HttpCallback(IntPtr url, I3dSitesGetterWrapper.I3dHttpParsingCallback parsingCallback, IntPtr parsingUserdata, IntPtr userdata) { I3dSitesGetter sitesGetter; if (!SitesGetter.TryGetValue(userdata, out sitesGetter)) { throw new InvalidOperationException("Cannot find I3dSitesGetter instance"); } sitesGetter.StartCoroutine(sitesGetter.GetPayload(url, parsingCallback, parsingUserdata, userdata)); }
IEnumerator GetPayload(IntPtr url, I3dSitesGetterWrapper.I3dHttpParsingCallback parsingCallback, IntPtr parsingUserdata, IntPtr userdata) { using (var url_string = new Utf8ByteArray(url)) { UnityWebRequest www = UnityWebRequest.Get(url_string.ToString()); yield return(www.SendWebRequest()); using (var json = new Utf8ByteArray(www.downloadHandler.text)) { parsingCallback(true, json, parsingUserdata); } } }