Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.71 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System.IO;
  5.  
  6.  
  7. public class imgdownloader : MonoBehaviour {
  8.  
  9.     public string url = "https://api.nasa.gov/planetary/apod?api_key=a9gKbyf2cWMGOrHRen6J1C414DpQcjOhFsPTlUVF";
  10.     public string data = "hejka:*";
  11.    
  12.     public string odpowiedzJson;
  13.     public bool PobierzDane = false;
  14.     [HideInInspector]
  15.     public bool pobrano = false;
  16.  
  17.     // Use this for initialization
  18.     void Start () {
  19.        
  20.  
  21.     }
  22.    
  23.     // Update is called once per frame
  24.     void Update () {
  25.  
  26.         if (PobierzDane)
  27.         {
  28.             PobierzDane = false;
  29.             StartCoroutine(Loadimage ());
  30.  
  31.         }
  32.         string chujdupa;
  33.         Debug.Log(chujdupa);
  34.         Debug.Log(string.Format hejjj)
  35.     }
  36.     https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?earth_date=2015-6-3&api_key=DEMO_KEY
  37.     void OnGUI()
  38.     {
  39.         // Make a text field that modifies stringToEdit.
  40.         data = GUI.TextField(new Rect(100, 100, 50, 20), data, 25);
  41.         Debug.Log(string.Format("https://api.nasa.gov/mars-photos/api/v1/rovers/curiosity/photos?earth_date={0}&api_key=DEMO_KEY&fbclid=IwAR18f8tfBH1Qn2RQpY81y5QG_WN6K9T69xfSZ7UU_WT3kZC9VMUam3STlkQ", data));
  42.     }
  43.     public IEnumerator Loadimage()
  44.     {
  45.  
  46.  
  47.         pobrano = false;
  48.         WWW readingsite = new WWW(url);
  49.         yield return readingsite;
  50.  
  51.         if (string.IsNullOrEmpty(readingsite.error))
  52.         {
  53.             odpowiedzJson = readingsite.text;
  54.             Debug.Log(odpowiedzJson);
  55.             pobrano = true;
  56.  
  57.  
  58.         }
  59.         else
  60.         {
  61.             odpowiedzJson = " ";
  62.  
  63.         }
  64.  
  65.  
  66.        
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.            
  75.  
  76.  
  77.     }
  78.  
  79.  
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement