// Get the Favourite Poster List in async way void getFavoriteList(object favourite) { Favourite check = favourite as Favourite; check.GetFavourites(); Favourite[] favorList = check.favourites; foreach (Favourite favor in favorList) { if (favor.targetid.Equals(targetid)) { Loom.QueueOnMainThread(changeButtonStatus, true); return; } } Loom.QueueOnMainThread(changeButtonStatus, false); }
//This is called when the user clicks on thumbnail of a poster. It enlarges the poster to fullsize. public void EnlargeImg(GameObject go) { RawImage img = this.GetComponentInChildren <RawImage>(); Favourite f_get = new Favourite(); f_get.userid = storeLoginSessionId.loginId; f_get.GetFavourites(); string n = go.name; for (int i = 0; i < f_get.favourites.Length; i++) { Poster p = new Poster(); Favourite f = f_get.favourites[i]; p.targetid = f.targetid; p.GetPoster(); string s2 = p.targetid; if (s2.Equals(n)) { string url = p.thumbnail; StartCoroutine(LoadImageFromUrl(url, img)); planeDetectModelString = p.targetid; timeText.text = p.posdate; addressText.text = p.poslocation; addressURL.text = p.posmap; linkText.text = p.poslink; posterTitle.text = p.postitle; keyId.text = p.targetid; relevantInfo.text = p.relevantinfo; return; } } return; }
// Use this for initialization void Start() { GameObject posters; //clone list items (poster) Favourite f_get = new Favourite(); f_get.userid = storeLoginSessionId.loginId; f_get.GetFavourites(); if (f_get.favourites.Length == 0) { originObject.SetActive(false); if (storeLoginSessionId.loginId == -1) { text2.GetComponent <Text>().color = new Color(133 / 255.0f, 36 / 255.0f, 213 / 255.0f, 1f); } text1.GetComponent <Text>().color = new Color(133 / 255.0f, 36 / 255.0f, 213 / 255.0f, 1f); return; } Favourite firstone = f_get.favourites [0]; Poster pFirst = new Poster(); pFirst.targetid = firstone.targetid; Like_Button heart = originObject.transform.GetChild(1).GetComponent <Like_Button>(); heart.targetid = pFirst.targetid; pFirst.GetPoster(); string urlFirst = pFirst.thumbnail; RawImage imgFirst = this.GetComponentsInChildren <RawImage> ()[0]; StartCoroutine(LoadImageFromUrl(urlFirst, imgFirst)); Text tFirst = this.GetComponentsInChildren <Text> () [0]; tFirst.name = pFirst.targetid; tFirst.text = pFirst.postitle; for (int i = 1; i < f_get.favourites.Length; i++) { Poster p1 = new Poster(); p1.targetid = f_get.favourites[i].targetid; p1.GetPoster(); string url = p1.thumbnail; posters = GameObject.Instantiate(originObject, parentTransForm); RawImage[] imgs = posters.GetComponentsInChildren <RawImage> (); foreach (RawImage img in imgs) { // img.color = Random.ColorHSV (); StartCoroutine(LoadImageFromUrl(url, img)); Debug.Log(url); } Text[] texts = posters.GetComponentsInChildren <Text> (); foreach (Text t in texts) { t.name = p1.targetid; t.text = p1.postitle; } // StartCoroutine (LoadImageFromUrl (url,img)); // print (url); } }