public void AllActive(ShowingType showType, bool type) { if (!type) { foreach (KeyValuePair <ShowingType, List <GameObject> > obj in poolDic) { if (obj.Key == showType) { continue; } for (int i = 0; i < obj.Value.Count; i++) { if (obj.Value[i].activeSelf) { ActiveList.Add(obj.Value[i]); obj.Value[i].SetActive(type); } } } } else { for (int i = 0; i < ActiveList.Count; i++) { ActiveList[i].SetActive(true); } ActiveList.Clear(); } }
public void HideAll(ShowingType showType) { foreach (GameObject obj in poolDic[showType]) { obj.SetActive(false); } }
void InitPool(ShowingType showingType, GameObject prefabGO, int _MaxPoolCount) { if (!poolDic.ContainsKey(showingType)) { poolDic.Add(showingType, new List <GameObject>()); } for (int i = 0; i < _MaxPoolCount; ++i) { GameObject poolGO = GameObject.Instantiate(prefabGO) as GameObject; poolGO.transform.AttachTo(transform, true); poolGO.SetActive(false); poolDic[showingType].Add(poolGO); } }