Fix vehicle categories not showing

This commit is contained in:
Grinch_ 2022-06-30 06:18:12 +06:00
parent 3e48745587
commit 495a0d1207
3 changed files with 18 additions and 20 deletions

View File

@ -184,9 +184,10 @@ Overlay = "Overlay"
Position = "Position"
Remove = "Remove"
Favourites = "Add to favourites"
FavouritesText = "Added to favourites"
FavouritesNone = "You don't have any favourites!"
FavouritesRemove = "Remove from favourites"
FavouritesRemoveText = "Removed from favourites"
FavouritesText = "Added to favourites"
Close = "Close"
QuickSSKey = "Quick screenshot"
QuickTPKey = "Toogle quick teleport"
@ -556,7 +557,7 @@ Siren = "Siren"
SkidMarks = "Always skid marks"
Small = "Small"
SpawnInAir = "Spawn aircraft in air"
SpawnInside = "Spawn inside as driver"
SpawnInside = "Spawn as driver"
StayOnBike = "Don't fall off bike"
SteeringLock = "Steering lock"
SuspensionBias = "Suspension bias"

View File

@ -56,7 +56,7 @@ void ResourceStore::LoadTextureResource(std::string&& name)
if (!std::filesystem::exists(fullPath))
{
//Log::PrintWarn("Failed to load {}", fullPath);
Log::Print<eLogLevel::Warn>("Failed to load {}", fullPath);
return;
}
@ -66,7 +66,7 @@ void ResourceStore::LoadTextureResource(std::string&& name)
{
RwLinkList *pRLL = (RwLinkList*)pRwTexDictionary->texturesInDict.link.next;
RwTexDictionary *pEndDic;
bool addCategories = m_Categories.empty();
bool addCategories = (m_Categories.size() < 2); // "All"
do
{
pEndDic = (RwTexDictionary*)pRLL->link.next;
@ -114,7 +114,7 @@ void ResourceStore::LoadTextureResource(std::string&& name)
}
// Genereate categories
if (m_Type == TYPE_IMAGE_TEXT &&
if (m_Type != TYPE_TEXT_IMAGE &&
!std::count(m_Categories.begin(), m_Categories.end(), m_ImagesList.back().get()->m_CategoryName))
{
m_Categories.push_back(m_ImagesList.back().get()->m_CategoryName);

View File

@ -91,21 +91,8 @@ void Widget::DataList(ResourceStore& data, ArgCallback3 clickFunc, ArgCallback3
// Category box
ImGui::PushItemWidth((ImGui::GetWindowContentRegionWidth() - ImGui::GetStyle().ItemSpacing.x)/2);
Ui::ListBoxStr("##Categories", data.m_Categories, data.m_Selected);
ImGui::SameLine();
// Search box
data.m_Filter.Draw("##Filter");
if (strlen(data.m_Filter.InputBuf) == 0)
{
ImDrawList* drawlist = ImGui::GetWindowDrawList();
ImVec2 min = ImGui::GetItemRectMin();
min.x += ImGui::GetStyle().FramePadding.x;
min.y += ImGui::GetStyle().FramePadding.y;
drawlist->AddText(min, ImGui::GetColorU32(ImGuiCol_TextDisabled), "Search");
}
FilterWithHint("##Filter", data.m_Filter, TEXT("Window.Search"));
ImGui::PopItemWidth();
ImGui::Spacing();
@ -163,8 +150,13 @@ void Widget::DataList(ResourceStore& data, ArgCallback3 clickFunc, ArgCallback3
}
if (ImGui::BeginTabItem(TEXT("Window.FavouritesTab")))
{
ImGui::Spacing();
ImGui::PushItemWidth(ImGui::GetWindowContentRegionWidth());
FilterWithHint("##Filter", data.m_Filter, TEXT("Window.Search"));
ImGui::PopItemWidth();
ImGui::Spacing();
ImGui::BeginChild(1);
size_t count = 0;
for (auto [k, v] : *data.m_pData->GetTable("Favourites"))
{
std::string key = std::string(k.str());
@ -179,9 +171,14 @@ void Widget::DataList(ResourceStore& data, ArgCallback3 clickFunc, ArgCallback3
if (ImGui::IsItemClicked(1))
{
contextMenu = {std::string("Favourites"), key, val};
contextMenu = {std::string("Favourites"), key, val, removeFunc};
}
}
++count;
}
if (count == 0)
{
Widget::TextCentered(TEXT("Menu.FavouritesNone"));
}
if (contextMenu.func != nullptr)
{