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); }
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); } }
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); } } }
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; }
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); } }
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); } }