Skip to content

Commit

Permalink
update for double click and columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Rxann committed Mar 23, 2024
1 parent 7bb3282 commit 46c1e56
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/game/frontend/submenus/Self.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,22 +115,28 @@ namespace YimMenu::Submenus

AddCategory(std::move(animations));

auto recovery = std::make_shared<Category>("Recovery");
auto recovery = std::make_shared<Category>("Recovery");
auto recoveryColumns = std::make_shared<Column>(2);
auto spawnCollectiblesGroup = std::make_shared<Group>("Spawn Collectibles", GetListBoxDimensions());

static auto recoveryCommand = Commands::GetCommand<BoolCommand>("recoveryenabled"_J);

recovery->AddItem(std::make_shared<ImGuiItem>([=] {
spawnCollectiblesGroup->AddItem(std::make_shared<ImGuiItem>([=] {
if (recoveryCommand->GetState())
{
static Rewards::eRewardType selected;
std::map<Rewards::eRewardType, std::string> reward_translations = {{Rewards::eRewardType::GOLD_REWARDS, "Gold Rewards"}, {Rewards::eRewardType::HEIRLOOMS, "Heirlooms"}, {Rewards::eRewardType::COINS, "Coins"}, {Rewards::eRewardType::ALCBOTTLES, "Alcohol Bottles"}, {Rewards::eRewardType::ARROWHEADS, "Arrowheads"}, {Rewards::eRewardType::BRACELETS, "Bracelets"}, {Rewards::eRewardType::EARRINGS, "Earrings"}, {Rewards::eRewardType::NECKLACES, "Necklaces"}, {Rewards::eRewardType::RINGS, "Rings"}, {Rewards::eRewardType::TAROTCARDS_CUPS, "Tarot Cards - Cups"}, {Rewards::eRewardType::TAROTCARDS_PENTACLES, "Tarot Cards - Pentacles"}, {Rewards::eRewardType::TAROTCARDS_SWORDS, "Tarot Cards - Swords"}, {Rewards::eRewardType::TAROTCARDS_WANDS, "Tarot Cards - Wands"}};

for (auto& [type, translation] : reward_translations)
{
if (ImGui::Selectable(std::string("Spawn all ").append(translation).c_str(), type == selected))
if (ImGui::Selectable(std::string(translation).c_str(), type == selected, ImGuiSelectableFlags_AllowDoubleClick))
{
selected = type;
}
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
{
Rewards::SpawnRequestedRewards({selected});
}
}

if (ImGui::Button("Spawn Selected"))
Expand All @@ -148,6 +154,8 @@ namespace YimMenu::Submenus
}
}
}));
recoveryColumns->AddItem(spawnCollectiblesGroup);
recovery->AddItem(recoveryColumns);

AddCategory(std::move(recovery));
}
Expand Down

0 comments on commit 46c1e56

Please sign in to comment.