private void addButton(User user)
    {
        GameObject newButton = btnObjectPool.GetObject();

        newButton.transform.SetParent(contentPanel);

        ButtonUI button = newButton.GetComponent <ButtonUI>();

        button.setup(user.name);
        buttons.Add(button.button);
        button.button.onClick.AddListener(() => addColor(button));
    }
Exemple #2
0
    /* Add level buttons to content panel */
    public void addButtons()
    {
        loadLevels();
        for (int i = 0; i < levelList.Count; i++)
        {
            string info  = levelList[i];
            var    index = levelList[i].Length;
            info = info.Remove(0, 1);
            info = info.Remove(index - 2, 1);
            GameObject newButton = btnObjectPool.GetObject();
            newButton.transform.SetParent(contentPanel);

            ButtonUI button = newButton.GetComponent <ButtonUI>();
            button.setup(info);
            buttons.Add(button.button);
            button.button.onClick.AddListener(() => addColor(button));
        }
    }