/** * Adds the section buttons' icons to the imgDict */ public void GetSectionImages() { allChildren = SectionContentPar.GetComponentsInChildren <Transform>(); foreach (Transform t in allChildren) { if (t.name.Equals("Image")) { if (t.GetComponent <Image>().sprite.name != null && !t.GetComponent <Image>().sprite.name.Equals("")) { string s = t.GetComponent <Image>().sprite.name; SpriteHolderScript shs = new SpriteHolderScript(s); ds.AddImg(t.parent.Find("SectionLinkToText").GetComponent <Text>().text, t.GetComponent <Image>().sprite); foreach (Image img in shs.iconHolder.GetComponentsInChildren <Image>()) { if (img.sprite.name.Equals(s)) { ds.AddImg(t.parent.Find("SectionLinkToText").GetComponent <Text>().text, img.transform.parent.name); break; } } } } } //Debug.Log (string.Join (", ", ds.GetImages ().Keys.ToArray ())); //Debug.Log (string.Join ("-----", ds.GetImages ().Select (x => x.Value.GetXMLText()).ToArray ())); }
/*private IEnumerator LoadInTexture() * { * yield return www; * Debug.Log("loaded, www texture width = " + www.texture.width); * texture = www.texture; * }*/ public void ApplyImage() { currentImage.sprite = displayImage.sprite; if (currentImage.sprite == null) { currentImage.GetComponent <CanvasGroup>().alpha = 0f; currentImage.transform.parent.GetComponent <Image>().enabled = true; } else { currentImage.GetComponent <CanvasGroup>().alpha = 1f; currentImage.transform.parent.GetComponent <Image>().enabled = false; } row0.parent.Find("Row1/RemoveImageButton").GetComponent <Button>().interactable = false; string guid = currentImage.GetComponent <ReaderOpenImageUploadPanelScript>().GetGuid(); //serial.text; Debug.Log("Saved image: " + guid); if (displayImage.sprite == null) { Debug.Log("Removing Image: " + guid); ds.RemoveImage(guid); } else { ds.AddImg(guid, displayImage.sprite); } }