private void AddPopupToQueue(FMPopup popup, FMPopupManager.FMPopupPriority priority) { FMPopupManager.FMPPopupQueueItem item = new FMPopupManager.FMPPopupQueueItem(popup, priority); if (this.queuedList.Count == 0) { this.queuedList.Add(item); } else { int num = this.queuedList.Count; for (int i = this.queuedList.Count - 1; i >= 0; i--) { if (item.priority < this.queuedList[i].priority) { num = i; } else if (this.queuedList[i].priority == item.priority) { break; } } if (num >= this.queuedList.Count) { this.queuedList.Add(item); } else { this.queuedList.Insert(num, item); } } }
protected void CloseActivePopup(bool openQueued = true) { if (this.ActivePopup != null) { this.ActivePopup.Close(); this.ActivePopup = null; } if (openQueued && this.queuedList.Count > 0) { this.ActivePopup = this.GetFirstQueuedPopup(); this.ActivePopup.Open(); } }
protected void Open(FMPopup popup, FMPopupManager.FMPopupPriority priority = FMPopupManager.FMPopupPriority.Normal) { if (this.ActivePopup == null) { this.ActivePopup = popup; this.ActivePopup.Open(); } else { this.AddPopupToQueue(popup, priority); if (priority == FMPopupManager.FMPopupPriority.ForceOpen) { this.CloseActivePopup(true); } } }
public FMPPopupQueueItem(FMPopup popup, FMPopupManager.FMPopupPriority priority) { this.popup = popup; this.priority = priority; }
private FMPopup GetFirstQueuedPopup() { FMPopup popup = this.queuedList[0].popup; this.queuedList.RemoveAt(0); return popup; }