public ViewPool(Transform parent, PrefabRef <TView> prefab, PresentOptions options) : this(parent, prefab.ExtractPrefab(parent)) { if ((options & PresentOptions.UseLoadedViews) != 0) { Rui.FillPoolWithChildrenViews(this, parent, prefab, this.prefab, options); } }
ViewPool <TView, TData> Pool(PrefabRef <TView> prefabRef) { ViewPool <TView, TData> pool; if (pools.TryGetValue(prefabRef, out pool) == false) { var prefab = prefabRef.ExtractPrefab(parent); // if we have pool for this concrete prefab already we use that pool // and also make this pool default for this prefab key if (pools.TryGetValue(prefab, out pool) == false) { pool = new ViewPool <TView, TData>(parent, prefab); pools[prefab] = pool; } pools[prefabRef] = pool; // TODO implement proper prefab logic here if (options.Has(PresentOptions.UseLoadedViews)) { Rui.FillPoolWithChildrenViews(pool, parent, prefabRef, prefab, options); } recycleAction.ForEach(a => pool.AddRecycleAction(a)); if (instantiateAction != null) { pool.AddInstantiateAction(instantiateAction); } } return(pool); }