IEnumerator GetAnchors(double latitude, double longitude) { string data = "?lat=" + latitude + "&long=" + longitude; using (UnityWebRequest www = UnityWebRequest.Get("https://breadcrumbsar.herokuapp.com/getMapAnchors" + data)) { //www.SetRequestHeader("Content-Type", "application/json"); yield return(www.SendWebRequest()); String responseString = www.downloadHandler.text; AnchorResponse response = JsonConvert.DeserializeObject <AnchorResponse>(responseString); AnchorList[] anchorList = response.AnchorList; _locationStrings = new string[anchorList.Length]; for (var i = 0; i < anchorList.Length; i++) { _locationStrings[i] = anchorList[i].Latitude + ", " + anchorList[i].Longitude; Debug.Log(_locationStrings[i]); } if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.Log("Download complete!"); isListReady = true; yield break; } } }
IEnumerator PopulateAnchorQueue(double latitude, double longitude) { string data = "?lat=" + latitude + "&long=" + longitude; using (UnityWebRequest www = UnityWebRequest.Get("https://breadcrumbsar.herokuapp.com/getARAnchors" + data)) { //www.SetRequestHeader("Content-Type", "application/json"); yield return(www.SendWebRequest()); string responseString = www.downloadHandler.text; Debug.Log(responseString); AnchorResponse response = JsonConvert.DeserializeObject <AnchorResponse>(responseString); AnchorList[] anchorList = response.AnchorList; if (anchorList.Length == 0) { m_AppMode = AppMode.TouchToHostCloudAnchor; Debug.Log("did not find any anchors"); yield break; } for (var i = 0; i < anchorList.Length; i++) { cloudAnchorIdQueue.Enqueue(anchorList[i].AnchorId); Debug.Log(anchorList[i].AnchorId); } isQueueReady = true; if (www.isNetworkError || www.isHttpError) { Debug.Log(www.error); } else { Debug.Log("Download complete!"); yield break; } } }