feat(Notifications): Added push_success function (#1340)

This commit is contained in:
Rxann
2023-06-05 15:46:20 -04:00
committed by GitHub
parent afca330766
commit 56d9d39b71
16 changed files with 36 additions and 27 deletions

View File

@ -37,6 +37,11 @@ namespace big
this->push({NotificationType::DANGER, title, message, std::chrono::system_clock::now(), 7000.f, 1.f});
}
void notification_service::push_success(std::string title, std::string message)
{
this->push({NotificationType::SUCCESS, title, message, std::chrono::system_clock::now(), 7000.f, 1.f});
}
std::vector<notification> notification_service::get()
{
std::vector<notification> notifications_to_sent;

View File

@ -31,6 +31,7 @@ namespace big
void push(std::string, std::string);
void push_warning(std::string, std::string);
void push_error(std::string, std::string);
void push_success(std::string, std::string);
std::vector<notification> get();
std::map<NotificationType, ImVec4> notification_colors = {

View File

@ -61,7 +61,7 @@ namespace big
{
write << std::setw(4) << j << std::endl;
write.close();
g_notification_service->push("Squad spawner", std::string("Succesfully saved ").append(s.m_name));
g_notification_service->push_success("Squad spawner", std::string("Succesfully saved ").append(s.m_name));
fetch_squads();
return true;
}

View File

@ -187,7 +187,8 @@ namespace big
4.f,
5.f);
//LOG(INFO) << "Navmesh probably failed, issiuing regular task ";
g_notification_service->push_warning("VEHICLE_CONTROLLER"_T.data(), "VEHICLE_CONTROLLER_TRY_ALT_PATHFINDING"_T.data());
g_notification_service->push_warning("VEHICLE_CONTROLLER"_T.data(),
"VEHICLE_CONTROLLER_TRY_ALT_PATHFINDING"_T.data());
script::get_current()->yield(500ms);
}
@ -331,12 +332,14 @@ namespace big
if (vehicle_control::find_suitable_destination_near_player(destination, heading))
{
//LOG(INFO) << "Suitable destination found";
g_notification_service->push_warning("VEHICLE_CONTROLLER"_T.data(), "VEHICLE_CONTROLLER_FOUND_LOCATION"_T.data());
g_notification_service->push_success("VEHICLE_CONTROLLER"_T.data(),
"VEHICLE_CONTROLLER_FOUND_LOCATION"_T.data());
}
else
{
//LOG(INFO) << "Couldn't find suitable destionation, defaulting to offset of player\nThis might go wrong";
g_notification_service->push_warning("VEHICLE_CONTROLLER"_T.data(), "VEHICLE_CONTROLLER_FORCE_PATHFINDING"_T.data());
g_notification_service->push_error("VEHICLE_CONTROLLER"_T.data(),
"VEHICLE_CONTROLLER_FORCE_PATHFINDING"_T.data());
destination = behind_pos;
}