Ejemplo n.º 1
0
    protected UIListElementScript CreateElement(int index, ref stRect rect)
    {
        UIListElementScript uiListElementScript = null;

        if (m_unUsedElementScripts.Count > 0)
        {
            uiListElementScript = m_unUsedElementScripts[0];
            m_unUsedElementScripts.RemoveAt(0);
        }
        else if (m_elementTemplate != null)
        {
            GameObject gameObject1 = GameObject.Instantiate(m_elementTemplate);
            gameObject1.transform.SetParent(m_content.transform);
            gameObject1.transform.localScale = Vector3.one;
            base.InitializeComponent(gameObject1);
            uiListElementScript = gameObject1.GetComponent <UIListElementScript>();
        }
        if (uiListElementScript != null)
        {
            uiListElementScript.Enable(this, index, m_elementName, ref rect, IsSelectedIndex(index));
            m_elementScripts.Add(uiListElementScript);
        }
        return(uiListElementScript);
    }