Пример #1
0
        private void PoolContents()
        {
            if (contentPrefab == null || contentContainer == null)
            {
                return;
            }

            for (int i = 0; i < poolCount; i++)
            {
                MenuContentLayout contentLayout = Instantiate(contentPrefab, contentContainer);
                contentLayout.OnSelect += OnContentClicked;
                contentLayoutList.Add(contentLayout);
                contentLayout.gameObject.SetActive(false);
            }
        }
Пример #2
0
        private MenuContentLayout GetContentLayout()
        {
            MenuContentLayout currentContentLayout = null;

            foreach (MenuContentLayout contentLayout in contentLayoutList)
            {
                if (contentLayout.gameObject.activeInHierarchy)
                {
                    continue;
                }

                contentLayout.gameObject.SetActive(true);
                currentContentLayout = contentLayout;
                break;
            }

            return(currentContentLayout);
        }
Пример #3
0
        private void Internal_SetContents(MenuContent[] contents)
        {
            ClearContentLayout();

            if (contents == null || contents.Length == 0)
            {
                return;
            }

            foreach (MenuContent content in contents)
            {
                MenuContentLayout layout = GetContentLayout();

                if (layout == null)
                {
                    break;
                }

                layout.Set(content.thumbnail, content.text);
            }
        }