private IEnumerator SendPageRequests(PageLocation[] pages, OnPageRequestCompleted onCompletion) { throw new System.InvalidOperationException(); // Removed in order to prevent internet permission requirement // var results = new Dictionary<PageLocation, WWW>(); // foreach (var page in pages) { // var www = new WWW(PageRequestURL(page)); // results[page] = www; // yield return www; // } // var pageTexts = results.Keys.Select(delegate(PageLocation location) { // var www = results[location]; // if (www.text == "") { // Debug.Log("WWW Error: "+ www.error); // return new Page() { Location = location, Text = "Offline" }; // } else { // return new Page() { Location = location, Text = ParsePage(www.text) }; // } // }).ToArray(); // onCompletion(pageTexts); }
public void RequestPages(PageLocation[] locations, OnPageRequestCompleted onCompletion) { var pages = new Page[locations.Length]; for (int i = 0; i < locations.Length; i++) { pages[i] = PageAtLocation(locations[i]); } onCompletion(pages); }
public void RequestPages(PageLocation[] pages, OnPageRequestCompleted onCompletion) { StartCoroutine(SendPageRequests(pages, onCompletion)); }
public void RequestPages(PageLocation[] pages, OnPageRequestCompleted onCompletion) { librarian.RequestPages(pages, onCompletion); }