Ejemplo n.º 1
0
    private UISimplePool spawnPool(string poolName, GameObject prefab)
    {
        UISimplePool _pool;

        if (!_poolDic.TryGetValue(poolName, out _pool))
        {
            _pool = new UISimplePool(poolName, _poolRoot, prefab);
            _poolDic.Add(poolName, _pool);
        }
        return(_pool);
    }
Ejemplo n.º 2
0
    public void Perload(string poolName, GameObject prefab, int count = 1)
    {
        UISimplePool pool = getPool(poolName);

        if (pool != null)
        {
            pool.Perload(count);
        }
        else
        {
            UISimplePool _pool = spawnPool(poolName, prefab);
            _pool.Perload(count);
        }
    }
Ejemplo n.º 3
0
    public void Perload(string poolName, string prefabPath, int count = 1)
    {
        UISimplePool pool = getPool(poolName);

        if (pool != null)
        {
            pool.Perload(count);
        }
        else
        {
            GameObject prefab = createPerfab(prefabPath);
            if (prefab != null)
            {
                Perload(poolName, prefab);
            }
        }
    }
Ejemplo n.º 4
0
        private void createPool(GameObject template)
        {
            if (template == null)
            {
                return;
            }
            if (_poolDic.ContainsKey(template))
            {
                _curPool = _poolDic[template];
                return;
            }
            //create
            UISimplePool pool = new UISimplePool("ScrollView", _poolRoot, template);

            _poolDic.Add(template, pool);
            _curPool = pool;
        }
Ejemplo n.º 5
0
    public Transform Spawn(string poolName, string prefabPath)
    {
        UISimplePool pool = getPool(poolName);

        if (pool != null)
        {
            return(pool.Spawn());
        }
        else
        {
            GameObject prefab = createPerfab(prefabPath);
            if (prefab != null)
            {
                return(Spawn(poolName, prefab));
            }
            return(null);
        }
    }
Ejemplo n.º 6
0
    public Transform Spawn(string poolName, GameObject prefab = null)
    {
        UISimplePool pool = getPool(poolName);

        if (pool != null)
        {
            return(pool.Spawn());
        }
        else if (prefab != null)
        {
            pool = spawnPool(poolName, prefab);
            return(pool.Spawn());
        }
        else
        {
            Debug.LogError("prefab is null");
            return(null);
        }
    }