// Use this for initialization IEnumerator fetch(bool forwards) { // get list fetching = true; string fullURL = (forwards)? nextURL : previousURL; print(fullURL); WWW www = new WWW(fullURL); yield return(www); print("Fetched results..."); queryResult = (Hashtable)JSON.JsonDecode(www.text); Hashtable paging = (Hashtable)queryResult["paging"]; nextURL = (string)paging["next"]; previousURL = (string)paging["previous"]; print("nextURL: " + nextURL); feedItems = (ArrayList)queryResult["data"]; foreach (Hashtable item in feedItems) { Menu.AddToEnd(item); } print("Finished running fetch."); fetching = false; }
// Use this for initialization void Start() { if (!Menu) { Menu = GetComponent <MenuBase>(); if (!Menu) { print("I need a menu"); return; } } for (int i = 0; i < InitialItems; i++) { Menu.AddToEnd(currentIndex.ToString()); currentIndex++; } }
// Use this for initialization void fetch() { YouTubeQuery query = new YouTubeQuery(YouTubeQuery.DefaultVideoUri); YouTubeRequest request = new YouTubeRequest(new YouTubeRequestSettings("", DeveloperKey)); query.Query = keyword; query.NumberToRetrieve = ChunkSize; query.StartIndex = CurrentIndex; query.SafeSearch = YouTubeQuery.SafeSearchValues.None; // p**n // TODO: find out how to async this Feed <Video> videoFeed = request.Get <Video>(query); foreach (Video vid in videoFeed.Entries) { Menu.AddToEnd(vid); CurrentIndex++; } }
// Use this for initialization IEnumerator fetch() { // get list int index = Menu.GetComponentsInChildren <Transform>().Length; string Query = "?v=1.0&q=" + keyword + "&rsz=" + chunkSize + "&start=" + index; string fullURL = URL + Query; print(fullURL); WWW www = new WWW(fullURL); yield return(www); print("Fetched results..."); imageQueryResult = (Hashtable)JSON.JsonDecode(www.text); results = (ArrayList)((Hashtable)imageQueryResult["responseData"])["results"]; foreach (Hashtable result in results) { Menu.AddToEnd(result); } }