private static void UpdatePopupStack(UIPopup newPopup = null) { if (newPopup != null) { newPopup.transform.SetParent(Instance._popupLayer, false); Instance._popupStack.Push(newPopup); } else { var oldPopup = Instance._popupStack.Pop(); Destroy(oldPopup.gameObject); } foreach (var popup in Instance._popupStack) { popup.SetVisible(false); } if (ActivePopup != null) { ActivePopup.SetVisible(true); ActivePopup.Activate(); Scrimmer.ScrimOver(Instance._popupLayer); } else { Scrimmer.ClearScrim(Instance._popupLayer); } }
private static UIPopup CreatePopup(Type type) { UIPopup selectedPopup = null; foreach (var popup in Instance._popups) { if (popup.GetType() == type) { selectedPopup = Instantiate(popup.gameObject).GetComponent(type) as UIPopup; break; } } if (selectedPopup == null) { throw new ArgumentOutOfRangeException("Could not find a popup of type " + type.ToString() + " in the popups listed!"); } return(selectedPopup); }