feature(GUI): Notifications are gui styled. (#69)
* feature(GUI): Notifications are gui styled. * feature(GUI): Removed ~r~
This commit is contained in:
@ -40,6 +40,7 @@ namespace big
|
||||
static void settings();
|
||||
static void spoofing();
|
||||
static void navigation();
|
||||
static void notifications();
|
||||
static void active_view();
|
||||
|
||||
inline static animator window_animator = animator();
|
||||
@ -67,5 +68,10 @@ namespace big
|
||||
active_view();
|
||||
navigation();
|
||||
}
|
||||
|
||||
static void always()
|
||||
{
|
||||
notifications();
|
||||
}
|
||||
};
|
||||
}
|
@ -30,7 +30,7 @@ namespace big
|
||||
ImGui::SetNextWindowPos({ tabs_open_animation, 0.f }, ImGuiCond_Always);
|
||||
ImGui::SetNextWindowSize({ (float)g->window.x * 0.3f, (float)g->window.y }, ImGuiCond_Always);
|
||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.10f, 0.09f, 0.12f, 1.00f));
|
||||
if (ImGui::Begin("main", 0, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav))
|
||||
if (ImGui::Begin("main", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav))
|
||||
{
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, alpha);
|
||||
if (current_tab->tab != tabs::NONE)
|
||||
|
@ -2,7 +2,6 @@
|
||||
#include "fiber_pool.hpp"
|
||||
#include "script.hpp"
|
||||
#include "util/mobile.hpp"
|
||||
#include "util/notify.hpp"
|
||||
#include "services/mobile_service.hpp"
|
||||
|
||||
namespace big
|
||||
@ -10,8 +9,8 @@ namespace big
|
||||
void view::mobile() {
|
||||
components::button("Mors Mutual Fix All Vehicles", [] {
|
||||
int amount_fixed = mobile::mors_mutual::fix_all();
|
||||
notify::above_map(
|
||||
fmt::format("<C>{}</C> vehicle{} been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have")
|
||||
g_notification_service->push("Mobile",
|
||||
fmt::format("{} vehicle{} been fixed.", amount_fixed, amount_fixed == 1 ? " has" : "s have")
|
||||
);
|
||||
});
|
||||
|
||||
|
32
BigBaseV2/src/views/view_notifications.cpp
Normal file
32
BigBaseV2/src/views/view_notifications.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include "view.hpp"
|
||||
#include "services/notification_service.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void view::notifications()
|
||||
{
|
||||
ImGui::SetNextWindowSize({ (float)g->window.x * 0.2f, (float)g->window.y });
|
||||
ImGui::SetNextWindowPos({ (float)g->window.x - (float)g->window.x * 0.2f, 0 });
|
||||
if (ImGui::Begin("notifications", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoBackground))
|
||||
{
|
||||
std::vector<notification> notifications = g_notification_service->get();
|
||||
|
||||
for (int i = 0; i < notifications.size(); i++)
|
||||
{
|
||||
notification& n = notifications[i];
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, n.alpha);
|
||||
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImVec4(0.10f, 0.09f, 0.12f, 1.00f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.10f, 0.09f, 0.12f, 1.00f));
|
||||
ImGui::SetNextWindowBgAlpha(n.alpha);
|
||||
ImGui::BeginChild(i, ImVec2(0, 75.f + (float)(20 * (int)(n.message.size() / 28) + 20 * (float)std::count(n.message.begin(), n.message.end(), '\n'))), true, ImGuiWindowFlags_NoScrollbar);
|
||||
ImGui::Text(n.title.c_str());
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, g_notification_service->notification_colors.at(n.type));
|
||||
ImGui::TextWrapped(n.message.c_str());
|
||||
ImGui::PopStyleColor();
|
||||
ImGui::EndChild();
|
||||
ImGui::PopStyleVar();
|
||||
ImGui::PopStyleColor(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,7 +4,6 @@
|
||||
#include "script_global.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "util/player.hpp"
|
||||
#include "util/notify.hpp"
|
||||
#include "util/session.hpp"
|
||||
|
||||
namespace big
|
||||
@ -79,7 +78,7 @@ namespace big
|
||||
}
|
||||
if (!STREAMING::HAS_MODEL_LOADED(hash))
|
||||
{
|
||||
notify::above_map("~r~Failed to spawn model, did you give an incorrect model?");
|
||||
g_notification_service->push_error("Self", "Failed to spawn model, did you give an incorrect model ? ");
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ namespace big
|
||||
|
||||
components::button("Bring Personal Vehicle", [] {
|
||||
Vehicle veh = globals::get_personal_vehicle();
|
||||
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return notify::above_map("Invalid vehicle handle...");
|
||||
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return g_notification_service->push_error("Teleport", "Invalid vehicle handle...");
|
||||
|
||||
Vector3 location = ENTITY::GET_ENTITY_COORDS(PLAYER::PLAYER_PED_ID(), true);
|
||||
|
||||
@ -37,7 +37,7 @@ namespace big
|
||||
|
||||
components::button("Teleport to Personal Vehicle", [] {
|
||||
Vehicle veh = globals::get_personal_vehicle();
|
||||
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return notify::above_map("Invalid vehicle handle...");
|
||||
if (ENTITY::IS_ENTITY_DEAD(veh, false)) return g_notification_service->push_error("Teleport", "Invalid vehicle handle...");
|
||||
|
||||
teleport::to_coords(
|
||||
ENTITY::GET_ENTITY_COORDS(veh, true)
|
||||
|
Reference in New Issue
Block a user