Exemplo n.º 1
0
        private RectTransform InstantiateNextItem(int itemIdx)
        {
            if (m_PoolGroup == null)
            {
                m_PoolGroup = GameObjectPoolMgr.Instance.CreatePoolGroup(UIPoolStrategy.Instance);
            }

            string     poolName = null;
            GameObject prefab   = null;

            GetCellInfo(itemIdx, out poolName, out prefab);

            if (prefab == null)
            {
                return(null);
            }

            if (!m_PoolGroup.HasPool(poolName))
            {
                m_PoolGroup.AddPool(poolName, prefab, 0, 1);
            }

            //RectTransform nextCell = ResourceManager.Instance.GetObjectFromPool("NetImage", true, 1).GetComponent<RectTransform>();
            RectTransform nextCell = m_PoolGroup.Allocate(poolName).GetComponent <RectTransform>();

            nextCell.transform.SetParent(content, true);
            nextCell.gameObject.SetActive(true);
            SendMessageToNewObject(nextCell, itemIdx);

            return(nextCell);
        }
Exemplo n.º 2
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     if (m_PoolGroup != null)
     {
         m_PoolGroup.RemoveAllPool(false);
         m_PoolGroup = null;
     }
 }
        public GameObjectPoolGroup CreatePoolGroup(IGameObjectPoolStrategy strategy = null)
        {
            GameObjectPoolGroup group = new GameObjectPoolGroup(transform, strategy);

            return(group);
        }
 public override void OnSingletonInit()
 {
     m_Group = new GameObjectPoolGroup(transform);
 }