PopupManager
A class in Root.Township, the global namespace.
Client: singleton that shows popup boards one at a time from a static queue. Call a static Show overload from anywhere; it queues until the manager exists and the current popup closes.
- Listed in Global namespace: P
- Inherits or implements
SingletonBehaviour<PopupManager> - Derived types
PopupManager - Nested types
IPopupConfig,PopupConfig
Constructors
| Member | What it is |
|---|---|
PopupManager() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private Transform controlParent | Transform popups are spawned under. |
private PopupBoard defaultBoard | Board prefab used when a popup has none of its own. |
private static readonly Logger logger | NLog logger for popup activity. |
private static readonly Queue<PopupManager.IPopupConfig> popupQueue | Static queue of popups waiting to show. |
Properties
| Member | What it is |
|---|---|
IPopupBoard CurrentPopup { get; private set; } | The popup on screen, or null. |
Methods
| Member | What it is |
|---|---|
static PopupManager.IPopupConfig Show(IPopupBoard popup) | Queues a popup (a given board, or the default one with a title and message or a setup callback) and returns its config, which can cancel it. |
static PopupManager.IPopupConfig Show(string title, string message) | Queues a popup (a given board, or the default one with a title and message or a setup callback) and returns its config, which can cancel it. |
static PopupManager.IPopupConfig Show(IPopupBoard popup, string title, string message) | Queues a popup (a given board, or the default one with a title and message or a setup callback) and returns its config, which can cancel it. |
static PopupManager.IPopupConfig Show(Action<IPopupBoard> onSpawn) | Queues a popup (a given board, or the default one with a title and message or a setup callback) and returns its config, which can cancel it. |
static PopupManager.IPopupConfig Show(IPopupBoard popup, Action<IPopupBoard> onSpawn) | Queues a popup (a given board, or the default one with a title and message or a setup callback) and returns its config, which can cancel it. |
4 private and internal methods
| Member | What it is |
|---|---|
private void OnPopupClosed(IPopupBoard popup) | When the current popup closes, clears it and shows the next queued one. |
private void ProcessQueue() | Shows the next queued popup that hasn't been cancelled. |
private void ShowPopup(PopupManager.IPopupConfig popupConfig) | Spawns a popup under controlParent and makes it current. |
private void Start() | Shows anything queued before the manager existed. |