public IEnumerator RequestLinkage(MonoBehaviour caller, Action <CloudVRLinkage> onSucceeded, Action <long, string> onFailed) { UnityWebRequest request = CloudVRAPIHelper.Post(_owner, "/linkages", "{ \"content_id\": \"" + id + "\" }"); yield return(caller.StartCoroutine(CloudVRAPIHelper.HandleResponse(request, () => { if (CloudVRAPIHelper.CheckIfResponseIsOK(request.responseCode)) { Dictionary <string, object> linkage = MiniJSON.Json.Deserialize(request.downloadHandler.text) as Dictionary <string, object>; onSucceeded.Invoke(new CloudVRLinkage(linkage)); } else { onFailed.Invoke(request.responseCode, request.downloadHandler.text); } }, () => { onFailed.Invoke(CloudVRAPIHelper.ResponseCodeRequestError, request.error); } ))); }
public IEnumerator LoadThumbnail(MonoBehaviour caller, int index, Action <int, Texture2D> onSucceeded, Action <long, string> onFailed) { Assert.IsTrue(thumbnails != null && 0 <= index && index < thumbnails.Length); UnityWebRequest request = CloudVRAPIHelper.GetTexture(_owner, _thumbnailUrls[index]); yield return(caller.StartCoroutine(CloudVRAPIHelper.HandleResponse(request, () => { if (CloudVRAPIHelper.CheckIfResponseIsOK(request.responseCode)) { thumbnails[index] = DownloadHandlerTexture.GetContent(request); onSucceeded.Invoke(index, thumbnails[index]); } else { onFailed.Invoke(request.responseCode, request.downloadHandler.text); } }, () => { onFailed.Invoke(CloudVRAPIHelper.ResponseCodeRequestError, request.error); } ))); }