public void Push(PopupName name) { //1) find popup in __usedPopups -> Init -> Push //2) if didnt find popop in _usedPopups? instantiate popup in popupList -> Init -> Add Used Popups -> Push List <GameObject> popupObjs = null; if (_usedPopups.TryGetValue(name, out popupObjs)) { Debug.Log("popupObjs.Count : " + popupObjs.Count); for (int i = 0; i < popupObjs.Count; i++) { if (!popupObjs[i].activeSelf) { Push(popupObjs [i]); return; } } } GameObject popupObj = GameObject.Instantiate <GameObject> (_pupupPrefabList [(int)name], GetActivatedGroupTrans()); if (popupObjs == null) { popupObjs = new List <GameObject> (); popupObjs.Add(popupObj); _usedPopups.Add(name, popupObjs); } else { popupObjs.Add(popupObj); } Push(popupObj); }
int GetPopupIndex(PopupName popup) { return(popups.FindIndex( delegate(PopupView popupView) { return popupView.popupName.Equals(popup); })); }
public void OpenPopup(PopupName name) { GameObject openPopup = AllPopupObj.Find(item => item.name == name.ToString()); if (openPopup != null) { PopupStack.Push(openPopup); openPopup.SetActive(true); } }
//씬이 전환될때마다 그씬에 있는 UI들을 등록해준다. void SetPopupObj() { AllPopupObj.Clear(); for (PopupName i = PopupName.Start; i < PopupName.MAX; i++) { GameObject obj = GameObject.Find(i.ToString()); if (obj != null) { AllPopupObj.Add(obj); } } }
public void HidePopup(PopupName popupName) { popups[GetPopupIndex(popupName)].popup.Hide(); }
public void ShowPopup(PopupName popupName) { Debug.Log(popupName); popups[GetPopupIndex(popupName)].popup.Show(); }
public T GetPopup <T>(PopupName sName) => (T)popups[GetPopupIndex(sName)].popup.GetComponent <T>();