Exemple #1
0
    void populate(Dictionary <string, System.Object> population)
    {
        objects.Clear();
        int   count            = 0;
        float contentPanelSize = 40.0f;

        foreach (string key in population.Keys)
        {
            objects.Add(key, population[key]);
            if (count == 0)
            {
                listElement.gameObject.SetActive(true);
                listElement.text.text = key;
            }
            else
            {
                ListBoxElement element = Instantiate(listElement);
                otherElements.Add(element);
                Vector3 pos = listElement.transform.position;
                element.transform.SetParent(listElement.transform.parent);
                pos.y -= 30 * count;
                element.transform.SetPositionAndRotation(pos, new Quaternion());
                contentPanelSize += 30;
                element.text.text = key;
            }
            count++;
        }
        if (contentPanelSize < scrollElement.GetComponent <RectTransform>().sizeDelta.y)
        {
            contentPanelSize = scrollElement.GetComponent <RectTransform>().sizeDelta.y;
        }
        contentPanel.GetComponent <RectTransform>().sizeDelta =
            new Vector2(contentPanel.GetComponent <RectTransform>().sizeDelta.x,
                        contentPanelSize);
    }
        public CategoryView()
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            AvailableList     = new ListBoxElement(availableList);
            SelectedList      = new ListBoxElement(selectedList);
            ExcludeCategories = new CheckBoxElement(excludeCheckbox);
            AddButton         = new ButtonElement(addCategory);
            RemoveButton      = new ButtonElement(removeCategory);

            this.excludeCheckbox.Enabled = false;
        }