2022-05-04 19:16:40 +02:00
|
|
|
#include "services/vehicle_service.hpp"
|
|
|
|
#include "views/view.hpp"
|
2021-09-16 22:21:42 +02:00
|
|
|
|
|
|
|
namespace big
|
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
void view::handling_my_profiles()
|
2021-09-16 22:21:42 +02:00
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
if (g_local_player == nullptr || g_local_player->m_vehicle == nullptr || g_local_player->m_ped_task_flag & (int)ePedTask::TASK_FOOT)
|
2021-09-16 22:21:42 +02:00
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::Text("Please enter a vehicle.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!g_vehicle_service->update_mine())
|
|
|
|
ImGui::Text("Loading profiles...");
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (g_vehicle_service->m_my_profiles.size() == 0)
|
|
|
|
ImGui::Text("You have no profiles available for this vehicle.");
|
|
|
|
for (auto& key : g_vehicle_service->m_my_profiles)
|
2021-09-16 22:21:42 +02:00
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
if (auto it = g_vehicle_service->m_handling_profiles.find(key); it != g_vehicle_service->m_handling_profiles.end())
|
2021-09-16 22:21:42 +02:00
|
|
|
{
|
2022-05-04 19:16:40 +02:00
|
|
|
auto& profile = it->second;
|
2021-09-16 22:21:42 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
if (profile.share_code == g_vehicle_service->get_active_profile(profile.handling_hash))
|
|
|
|
ImGui::TextColored({ 0.1254f,0.8039f,0.3137f,1.f }, "Active");
|
2021-09-16 22:21:42 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::BeginTable("table", 3, ImGuiTableFlags_SizingStretchProp);
|
2021-09-16 22:21:42 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::TableNextRow();
|
2021-09-16 22:21:42 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("Name:");
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text(profile.name.c_str());
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("Share Code: %s", profile.share_code.c_str());
|
2021-09-16 22:21:42 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::TableNextRow();
|
2021-09-16 22:21:42 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::Text("Description:");
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
ImGui::TextWrapped(profile.description.c_str());
|
|
|
|
ImGui::TableNextColumn();
|
|
|
|
if (ImGui::Button("Load Profile"))
|
|
|
|
g_vehicle_service->set_handling_profile(profile);
|
2021-09-16 22:21:42 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::EndTable();
|
2021-09-16 22:21:42 +02:00
|
|
|
|
2022-05-04 19:16:40 +02:00
|
|
|
ImGui::Separator();
|
2021-09-16 22:21:42 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-05-04 19:16:40 +02:00
|
|
|
|
2021-09-16 22:21:42 +02:00
|
|
|
}
|
2022-05-04 19:16:40 +02:00
|
|
|
}
|