// Start is called before the first frame update void Start() { if (!string.IsNullOrEmpty(ThumbFull.planeDetectModelString)) { Poster p = new Poster(); p.targetid = ThumbFull.planeDetectModelString; p.GetPoster(); StartCoroutine(DownloadAndCache(p, plane)); } }
public void FacebookShare() { if (string.IsNullOrEmpty(keyid.text)) { return; } Poster poster = new Poster(); poster.targetid = keyid.text; poster.GetPoster(); FB.ShareLink(new System.Uri(poster.thumbnail), "Check it out!", "AR Poster Reader lol!", new System.Uri(poster.thumbnail)); Debug.Log(keyid.text); }
//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; }
public void OnNewSearchResult(TargetFinder.TargetSearchResult targetSearchResult) { GameObject newImageTarget = Instantiate(ImageTargetTemplate.gameObject) as GameObject; GameObject augmentation = null; if (augmentation != null) { augmentation.transform.SetParent(newImageTarget.transform); } if (ImageTargetTemplate) { ObjectTracker tracker = TrackerManager.Instance.GetTracker <ObjectTracker>(); ImageTargetBehaviour imageTargetBehaviour = (ImageTargetBehaviour)tracker.GetTargetFinder <ImageTargetFinder>().EnableTracking(targetSearchResult, newImageTarget); } if (!mIsScanning) { mCloudRecoBehaviour.CloudRecoEnabled = true; } TargetFinder.CloudRecoSearchResult cloudRecoSearchResult = (TargetFinder.CloudRecoSearchResult)targetSearchResult; string mTargetId = cloudRecoSearchResult.UniqueTargetId; Poster p = new Poster(); p.targetid = mTargetId; posterSessionId.posterId = mTargetId; p.GetPoster(); newImageTarget.GetComponent <CustomImageTargetBehaviour>().setPoster(p); if (mTargetId.Equals("13b49fe524904e80ad087ea3e8d95cea")) { YANObject.SetActive(true); YANObject.transform.parent = newImageTarget.transform; YANObject.transform.localPosition = new Vector3(0f, 0, 0); return; } if (p.type == 2) // 2 is graph type { Option opt = new Option(); opt.targetid = mTargetId; opt.GetOptions(); GameObject gmGraph = OnNewSearchGraph(); foreach (Option op in opt.options) { Material mat = new Material(Shader.Find("Standard")); float r = Random.Range(0f, 1f); float g = Random.Range(0f, 1f); float b = Random.Range(0f, 1f); float a = 0.9f; mat.SetVector("_Color", new Color(r, g, b, a)); mat.SetFloat("_Glossiness", 1.0f); //mat.SetVector("_ColorTo", Color.yellow); gmGraph.GetComponent <BarChartFeed>().setBars(op.value, op.key, mat); } gmGraph.transform.parent = newImageTarget.transform; gmGraph.transform.localPosition = new Vector3(-2f, -5, -1); gmGraph.transform.localScale = new Vector3(0.5f, 0.5f, 0.5f); return; } StartCoroutine(DownloadAndCache(p, newImageTarget)); }
// 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); } }