Advertisement
Guest User

Untitled

a guest
Apr 21st, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.66 KB | None | 0 0
  1. struct Jotason
  2.     {
  3.         public WWWForm form;
  4.         public string header;
  5.     }
  6.     List<Jotason> formularios;
  7.  
  8.  
  9.  
  10. public void POST()
  11.     {
  12.         StopAllCoroutines();
  13.         StartCoroutine(Upload());
  14.     }    
  15.  
  16.     IEnumerator Upload()
  17.     {
  18.         if (enviarFormularios)
  19.         {
  20.             loadingPanel.SetActive(true);
  21.             int numArchivos = 0;
  22.             foreach (Jotason archivo in formularios)
  23.             {
  24.                 numArchivos++;
  25.                 UnityWebRequest www = UnityWebRequest.Post("https://holstein.fdi.ucm.es/tfg-mapas", archivo.form); //http://localhost:3000/posts https://holstein.fdi.ucm.es/tfg-mapas
  26.                 yield return www.SendWebRequest();
  27.  
  28.                 if (www.isNetworkError || www.isHttpError)
  29.                 {
  30.                     //WriteFormError(www.error, DLogType.Form);
  31.                     //WriteFormError(www.responseCode, DLogType.Form);
  32.                 }
  33.                 else
  34.                 {
  35.                     //WriteForm("Form upload complete!", DLogType.Form);
  36.                 }
  37.                 //
  38.             }
  39.             yield return new WaitUntil(() => numArchivos >= formularios.Count);
  40.         }
  41.  
  42.         //Reiniciar pal siguiente nivel        
  43.         formularios = new List<Jotason>();
  44.         CalcularIdUsuario();
  45.         SceneManager.LoadScene("Test_Dungeon");
  46.         Time.timeScale = 1; //Reinicamos el tiempo
  47.         loadingPanel.SetActive(false);
  48.         victoryPanel.SetActive(false);
  49.         defeatPanel.SetActive(false);
  50.         movimientoEnemigos = false;
  51.         StartCoroutine(bajarVolumen());
  52.         //unityFileDebug.SetActive(true);        
  53.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement