예제 #1
0
        private IEnumerator LoadItemTex(TemplateWindowItem item)
        {
            item.window.RequestCapture();


            yield return(new WaitForSeconds(1f));

            item.pic.texture = item.window.texture;
        }
예제 #2
0
        private IEnumerator BuildWindowList(bool forceRefresh = false)
        {
            windowsLoaded = false;

            if (forceRefresh)
            {
                foreach (Transform child in _windowsRectTransform)
                {
                    Destroy(child.gameObject);
                }

                windowItems.Clear();
            }


            foreach (TemplateWindowItem item in windowItems)
            {
                item.exists = false;
            }


            List <UwcWindow> allWindows = UwcManager.windows.Values.ToList();


            //foreach (KeyValuePair<int, UwcWindow> kvp in UwcManager.windows) {

            for (int i = 0; i < allWindows.Count; i++)
            {
                UwcWindow window = allWindows[i];

                //See if we should display it or not:
                if (window.title == "")
                {
                    continue;
                }

                bool skip = false;
                foreach (TemplateWindowItem temp in windowItems)
                {
                    if (temp.window.handle == window.handle)
                    {
                        temp.exists = true;
                        skip        = true;
                        break;
                    }
                }

                if (skip)
                {
                    continue;
                }



                TemplateWindowItem item = Instantiate(_windowItemPF, _windowsRectTransform).GetComponent <TemplateWindowItem>();

                item.exists = true;
                item.window = window;

                //window.PopulateFriendlyTitle(true);
                item.title.SetText(window.title);

                StartCoroutine(LoadItemTex(item));
                //item.pic.texture = item.window.texture;

                windowItems.Add(item);



                yield return(null);
            }


            //Destroy the windows that don't exist anymore:
            for (int i = windowItems.Count - 1; i >= 0; i--)
            {
                if (windowItems[i].exists)
                {
                    continue;
                }
                Destroy(windowItems[i].gameObject);
                windowItems.RemoveAt(i);
            }


            windowsLoaded = true;

            yield break;
        }