// ---------------------------------------------------------------------------------------- public bool ShowPopup(string popupText, string popupLabel = "", PopupDialogButtonCallback onClose = null, PopupType mode = PopupType.Notification, bool closeOnFinish = true, params string[] stringArgs) // ---------------------------------------------------------------------------------------- { PopupInfo info = new PopupInfo(popupText, popupLabel, onClose, mode, closeOnFinish, stringArgs); _waitingPopups.Add(info); if (_currentPopup == null) { ShowNextPopup(); } return(true); }
// ---------------------------------------------------------------------------------------- public void ClearPersistentMessage() // ---------------------------------------------------------------------------------------- { for (int i = _waitingPopups.Count - 1; i >= 0; i--) { if (_waitingPopups[i].Mode == PopupType.PersistentMessage) { _waitingPopups.RemoveAt(i); } } if (_currentPopup != null && _currentPopup.Mode == PopupType.PersistentMessage) { _interface.HidePopup(_currentPopup.CloseOnFinish); _currentPopup = null; } }
// ------------------------------------------------------------------- // this closes the current popup and shows the next one void ShowNextPopup() // ------------------------------------------------------------------- { if (_waitingPopups.Count == 0) // no popups in queue, hide stuff { if (_currentPopup != null) { bool hideOnClose = _currentPopup.CloseOnFinish; _currentPopup = null; _interface.HidePopup(hideOnClose); } } else { _currentPopup = _waitingPopups[0]; _waitingPopups.RemoveAt(0); _popupStartTime = Time.time; _interface.ShowPopup(_currentPopup); } }