Esempio n. 1
0
	void refresh() {
		flight2 = PlaneXML.FlightStatus(flightID);
		GameObject.Find ("card1").transform.FindChild ("value").GetComponent<TextMesh> ().text = "\n" + flight2.GS + "kt";
		GameObject.Find ("card2").transform.FindChild ("latVal").GetComponent<TextMesh> ().text = "Lat: " + Math.Round((Decimal)flight2.Lat, 4);
		GameObject.Find ("card2").transform.FindChild ("longVal").GetComponent<TextMesh> ().text = "Lon: " + Math.Round((Decimal)flight2.Lon, 4);
		GameObject.Find ("card3").transform.FindChild ("value").GetComponent<TextMesh> ().text = "\n20° C";
		GameObject.Find ("card4").transform.FindChild ("value").GetComponent<TextMesh> ().text = "\n" + flight2.Alt + "ft";
		GameObject.Find ("card5").transform.FindChild ("value").GetComponent<TextMesh> ().text = "\n" + flight2.ArrivalMins + "min";
	}
Esempio n. 2
0
	IEnumerator refresh() {
		flight2 = PlaneXML.FlightStatus(flightID);
		print("Latitude " + flight2.Lat);
		print("Longitude " + flight2.Lon);
		print("Altitude " + flight2.Alt);
		print("Arrival Mins. " + flight2.ArrivalMins);
		print("Ground Speed " + flight2.GS);
		float lat = (float)flight2.Lat;
		float lng = (float)flight2.Lon;
		float alt = (float)flight2.Alt * 0.3048f; //Feet to meters
		float radius = Mathf.Tan (60f * Mathf.Deg2Rad) * alt;
		//DEBUG
		//lat = 37.750179f;
		//lng = -122.462813f;
		//radius = 20000;
		//
		string url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=" + lat + "," + lng + "&radius=" + (int)radius + "&types=airport|aquarium|museum|casino|shopping_mall|stadium|zoo|university&key=AIzaSyC-CL4XpshMmVqpGnBiuL1GRe0PLinj-U0";
		www = new WWW (url);
		yield return www;
		string json = www.text;
		print (json);
		var N = JSON.Parse (json);

		int i = -1;
		int k = -1;
		
		while (N["results"][++k]["id"] != null) {
			;
		}
		int size = k;
		cardTitles = new string[k];
		wikiTexts = new string[k];

		while (N["results"][++i]["id"] != null) {
	
			cardTitles[i] = N["results"] [i] ["name"];
			WWW w = new WWW(("https://en.wikipedia.org/w/api.php?action=opensearch&search=" + cardTitles[i] + "&limit=1&namespace=0&format=json").Replace(" ", "%20"));
			yield return w;
			var temp = JSON.Parse(w.text);
			print (temp[1][0]);
			if(temp[0] != null)
				cardTitles[i] = temp[1][0];
			else {
				cardTitles[i] = null;
			}

			List<string> titleList = new List<string>(cardTitles);
			List<string> newTitleList = new List<string>();
			for(int a = 0; a < titleList.Count; a++) {
				if(titleList.ElementAt(a) != null)
					newTitleList.Add(titleList.ElementAt(a));
			}

					              
			WWW w2 = new WWW (("https://en.wikipedia.org/w/api.php?action=query&prop=extracts&exintro&explaintext&titles=" + newTitleList[i] + "&format=json").Replace(" ", "%20"));
			yield return w2;
			var temp2 = JSON.Parse(w2.text);
			if(temp2["query"]["pages"][0][3] != null) { 
				wikiTexts[i] = StripHTML(temp2["query"]["pages"][0][3], true);

				titles.Add(newTitleList.ElementAt(i));
				bodies.Add(wikiTexts[i]);
			}

			if (i > 100)
				break;
		}

		createCards ();

	}        
Esempio n. 3
0
	void refresh() {
		flight2 = PlaneXML.FlightStatus(flightID);
	}