Beispiel #1
0
        // Displaying item data
        public void SetData(ListViewImagesItem item)
        {
            // save item so later can fix item.Height to actual value
            Item = item;

            Url.text = (Item.Url != "") ? Item.Url : "No image";

            if (Cache.ContainsKey(Item.Url))
            {
                SetImage();
            }
            else
            {
                // reset images parameter
                Image.texture = null;
                ImageLayoutElement.preferredHeight = -1;
                ImageLayoutElement.preferredWidth  = -1;

                if ((Item.Url != "") && (Item.Url != null))
                {
                    Image.color = Color.white;
                    ImageLayoutElement.minHeight = 100;
                    ImageLayoutElement.minWidth  = 100;

                    loadCorutine = Load();
                    StartCoroutine(loadCorutine);
                }
                else
                {
                    Image.color = Color.clear;
                    ImageLayoutElement.minHeight = -1;
                    ImageLayoutElement.minWidth  = -1;
                }
            }
        }
        // Displaying item data
        public void SetData(ListViewImagesItem item)
        {
            // save item so later can fix item.Height to actual value
            Item = item;

            //			Url.text = (Item.Url!="") ? Item.Url : "No image";

            if (Cache.ContainsKey(Item.Url))
            {
                SetImage();
            }
            else
            {
                // reset images parameter
                ImageLayoutElement.preferredHeight = -1;
                ImageLayoutElement.preferredWidth  = -1;

                if ((Item.Url != "") && (Item.Url != null))
                {
                    Image.color = Color.white;
                    ImageLayoutElement.minHeight = item.Height;
                    ImageLayoutElement.minWidth  = item.Height;

                    loadCorutine = Load();
                    StartCoroutine(loadCorutine);
                    Image.GetComponent <RectTransform>().sizeDelta = new Vector2(item.Height, item.Height);
                }
                else
                {
                    Image.color = Color.clear;
                    ImageLayoutElement.minHeight = -1;
                    ImageLayoutElement.minWidth  = -1;
                }
            }
        }