ReusingScrollItemBase GetItem()
    {
        ReusingScrollItemBase result = null;

        if (m_itemCatchs.Count > 0)
        {
            result = m_itemCatchs[0];
            result.gameObject.SetActive(true);
            m_itemCatchs.RemoveAt(0);

            m_items.Add(result);
            return(result);
        }

        result = GameObjectManager.CreatGameObjectByPool(m_itemPrefab).GetComponent <ReusingScrollItemBase>();
        result.Init();
        m_items.Add(result);

        return(result);
    }
示例#2
0
    ReusingScrollItemBase GetItem()
    {
        ReusingScrollItemBase result = null;

        if (m_itemCaches.Count > 0)
        {
            result = m_itemCaches[0];
            result.gameObject.SetActive(true);
            result.OnShow();
            m_itemCaches.RemoveAt(0);

            m_items.Add(result);
            return(result);
        }

        result = GameObjectManager.Instance.CreatePoolObject(m_ItemName).GetComponent <ReusingScrollItemBase>();
        result.Init(m_items.Count);
        m_items.Add(result);

        return(result);
    }