예제 #1
0
        private IEnumerator LoadImages(IEnumerable <string> results)
        {
            Vector3 startPosition = Camera.main.WorldToScreenPoint(SpawnStartLocation.transform.position);

            startPosition.y = Screen.height - startPosition.y;

            Vector3 endPosition = Camera.main.WorldToScreenPoint(SpawnEndLocation.transform.position);

            endPosition.y = Screen.height - endPosition.y;

            float width           = endPosition.x - startPosition.x;
            int   boxWidth        = (int)(width * 0.8f);
            float leftRightMargin = width * 0.2f;
            float topBottomMargin = width * 0.05f;

            searchScrollContentHeight = 0;

            int i = DataMessenger.LastSetsQuery.GetHashCode();

            foreach (var result in results)
            {
                CardData data = new CardData();
                data.Image = result;
                data.Id    = i;
                data.Title = DataMessenger.LastSetsQuery;

                yield return(StartCoroutine(WebCache.Cache(data)));

                string path = WebCache.GetCachedPath(data);

                WWW www = new WWW(path);
                yield return(www);

                var image = AddToSearchResults(www.texture, boxWidth, leftRightMargin, topBottomMargin);
                image.Tag = data;

                searchItems.Items.Add(image);

                searchItems.MeasureSize();
                searchScrollContentHeight = searchItems.Rect.height;
                ++i;
            }
        }