public override void OnTick() { base.OnTick(); bool hasDisplayedPopup = false; bool hasDisplayedTio = false; lock (Popups) { foreach (var popup in Popups.OrderByDescending(p => p.Priority).ThenByDescending(p => p.CurrentTick)) { if (popup.CurrentTick > popup.Duration + popup.DisplayDelay) { Popups.Remove(popup); continue; } if (popup.CurrentTick > popup.DisplayDelay) { if (popup.MessageType == MessageType.Popup && !hasDisplayedPopup) { SendMessage(popup.Message, type: (byte)popup.MessageType); hasDisplayedPopup = true; } if (popup.MessageType == MessageType.Tip && !hasDisplayedTio) { SendMessage(popup.Message, type: (byte)popup.MessageType); hasDisplayedTio = true; } } popup.CurrentTick++; } } }