[UI] Host Notification: Replace previous notification in case of new one
This commit is contained in:
@@ -467,20 +467,32 @@ void ImGuiDrawer::Draw(UIDrawContext& ui_draw_context) {
|
||||
dialog_loop_next_index_ = SIZE_MAX;
|
||||
|
||||
if (!notifications_.empty()) {
|
||||
bool was_guest_notification_drawn = false;
|
||||
bool was_host_notification_drawn = false;
|
||||
std::vector<ui::ImGuiNotification*> guest_notifications = {};
|
||||
std::vector<ui::ImGuiNotification*> host_notifications = {};
|
||||
|
||||
for (const auto& notification : notifications_) {
|
||||
if (notification->GetNotificationType() == NotificationType::Guest &&
|
||||
!was_guest_notification_drawn) {
|
||||
was_guest_notification_drawn = true;
|
||||
notification->Draw();
|
||||
}
|
||||
std::copy_if(notifications_.cbegin(), notifications_.cend(),
|
||||
std::back_inserter(guest_notifications),
|
||||
[](ui::ImGuiNotification* notification) {
|
||||
return notification->GetNotificationType() ==
|
||||
NotificationType::Guest;
|
||||
});
|
||||
|
||||
if (notification->GetNotificationType() == NotificationType::Host &&
|
||||
!was_host_notification_drawn) {
|
||||
was_host_notification_drawn = true;
|
||||
notification->Draw();
|
||||
std::copy_if(notifications_.cbegin(), notifications_.cend(),
|
||||
std::back_inserter(host_notifications),
|
||||
[](ui::ImGuiNotification* notification) {
|
||||
return notification->GetNotificationType() ==
|
||||
NotificationType::Host;
|
||||
});
|
||||
|
||||
if (guest_notifications.size() > 0) {
|
||||
guest_notifications.at(0)->Draw();
|
||||
}
|
||||
|
||||
if (host_notifications.size() > 0) {
|
||||
host_notifications.at(0)->Draw();
|
||||
|
||||
if (host_notifications.size() > 1) {
|
||||
host_notifications.at(0)->SetDeletionPending();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user