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

            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);
        }
Ejemplo n.º 2
0
 protected override void OnDestroy()
 {
     base.OnDestroy();
     if (m_PoolGroup != null)
     {
         m_PoolGroup.RemoveAllPool(false);
         m_PoolGroup = null;
     }
 }
Ejemplo n.º 3
0
        public GameObjectPoolGroup CreatePoolGroup(IGameObjectPoolStrategy strategy = null)
        {
            GameObjectPoolGroup group = new GameObjectPoolGroup(transform, strategy);

            return(group);
        }
Ejemplo n.º 4
0
 public override void OnSingletonInit()
 {
     m_Group = new GameObjectPoolGroup(transform);
 }