/// <summary> Removes the first UIPopup registered with the given popupName from the PopupQueue (if it exists) </summary> /// <param name="popupName"> The popup name to search for </param> /// <param name="showNextInQueue"> After removing the corresponding UIPopup from the PopupQueue, should the next popup in queue be shown? </param> public static void RemoveFromQueue(string popupName, bool showNextInQueue = true) { if (!IsInQueue(popupName)) { return; } UIPopupQueueData data = GetPopupData(popupName); if (data == null) { return; } PopupQueue.Remove(data); if (Instance.DebugComponent) { DDebug.Log("UIPopup '" + data.PopupName + "' removed from the PopupQueue", Instance); } if (data.Popup == null) { return; } data.Popup.AddedToQueue = false; if (CurrentVisibleQueuePopup != data.Popup) { return; } CurrentVisibleQueuePopup = null; if (showNextInQueue) { ShowNextInQueue(); } }
/// <summary> Add the passed UIPopup to the PopupQueue </summary> /// <param name="popup"> Target UIPopup to be added to the PopupQueue </param> /// <param name="instantAction"> When shown, should the popup animate instantly? (in zero seconds) </param> public static void AddToQueue(UIPopup popup, bool instantAction = false) { var data = new UIPopupQueueData(popup, instantAction); PopupQueue.Add(data); popup.AddedToQueue = true; if (Instance.DebugComponent) { DDebug.Log("UIPopup '" + popup.PopupName + "' added to the PopupQueue", Instance); } if (CurrentVisibleQueuePopup != null) { return; } ShowNextInQueue(); }