private IEnumerator LoadImage() { string url = null; if (TI_API.GetSubdependencie().images != null) { url = TI_API.GetSubdependencie().images[0].imageUrl; } if (url != null) { //WWWForm form = new WWWForm(); //form.AddField("email", _usuario); //form.AddField("password", _password); UnityWebRequest img = UnityWebRequestTexture.GetTexture(url.ToString()); //WWW img = new WWW(url); Debug.Log("Downloading Image"); Debug.Log("URL: " + url.ToString()); yield return(img.Send()); if (img.isNetworkError || img.isHttpError) { string msg = ""; Debug.LogError("Download error: " + img.error); if (img.isNetworkError) { msg = "Error de conexión con el servidor"; } } else { DebugUnity.Log("Scale Download Successful!"); DebugUnity.Log("Scale response: " + img.downloadHandler.text); } Debug.Log(img.downloadedBytes); Debug.Log(img.downloadedBytes.ToString()); //Texture a = new Texture(); DownloadHandlerTexture handler = (DownloadHandlerTexture)img.downloadHandler; Sprite sprt = Sprite.Create(handler.texture, new Rect(0, 0, handler.texture.width, handler.texture.height), new Vector2(0.5f, 0.5f)); scaleView.sprite = sprt; scaleView.gameObject.SetActive(true); } else { Debug.LogWarning("No image attached"); scaleView.gameObject.SetActive(false); yield return(null); } }
public override void CargarLista(int id) { base.CargarLista(id); Subdependencie subdependencie = TI_API.GetSubdependencie(myIndex); DebugUnity.Log("Load Studies: [" + myIndex + "] " + subdependencie.name); if (subdependencie.studies != null) { for (int i = 0; i < subdependencie.studies.Length; i++) { ElementoLista el = AddBoton(subdependencie.studies[i].name + " " + subdependencie.studies[i].date + (!string.IsNullOrEmpty(subdependencie.studies[i].off_url) ? " (Scan)" : "") + (!string.IsNullOrEmpty(subdependencie.studies[i].pdf_url) ? " (PDF)" : ""), i); el.elegirEntregable = elegirEntregable; } } }
public void CheckScale() { string url = null; if (TI_API.GetSubdependencie().images != null) { url = TI_API.GetSubdependencie().images[0].imageUrl; } if (url == null) { txtNoScale.SetActive(true); } else { txtNoScale.SetActive(false); } }