Working on inventory

This commit is contained in:
Vladislav Khorev committed 2026-05-28 14:43:05 +03:00
1 parent 586ffc99b6
commit dda9f34277
25 files changed
+329 -10

No files matched your search

+17 -2
View File
@@ -45,6 +45,7 @@ namespace ZL {
phoneScreenRoot = loadUiFromFile("resources/w/ui/screen_phone.json", renderer, zipFile);
journalScreenRoot= loadUiFromFile("resources/w/ui/screen_journal.json", renderer, zipFile);
inventoryRoot = loadUiFromFile("resources/config2/ui_inventory.json", renderer, zipFile);
newInventoryRoot = loadUiFromFile("resources/w/ui/screen_inventory.json", renderer, zipFile);
questJournalRoot = loadUiFromFile("resources/config2/ui_quest_journal.json", renderer, zipFile);
questJournal.loadFromFile("resources/quests/quests.json", zipFile);
@@ -55,18 +56,28 @@ namespace ZL {
void MenuManager::enterGameplay() {
state = GameState::Gameplay;
uiManager.replaceRoot(hudRoot);
/*
uiManager.setTextButtonCallback("inventory_button", [this](const std::string&) {
openInventory();
});
uiManager.setTextButtonCallback("quest_journal_button", [this](const std::string&) {
openQuestJournal();
});*/
uiManager.setButtonCallback("inventoryButton", [this](const std::string&) {
openInventory();
});
//openInventory()
}
void MenuManager::openInventory() {
state = GameState::Inventory;
uiManager.pushMenuFromSavedRoot(newInventoryRoot);
uiManager.setButtonCallback("inventoryExitButton", [this](const std::string&) {
closeInventory();
});
/*
uiManager.pushMenuFromSavedRoot(inventoryRoot);
uiManager.setTextButtonCallback("close_inventory_button", [this](const std::string&) {
@@ -84,7 +95,7 @@ namespace ZL {
itemText += std::to_string(i + 1) + ". " + items[i].name + "\n";
}
}
uiManager.setText("inventory_items_text", itemText);
uiManager.setText("inventory_items_text", itemText);*/
}
void MenuManager::closeInventory() {
@@ -209,6 +220,10 @@ namespace ZL {
if (state == GameState::Gameplay && nextRoot) {
uiManager.replaceRoot(nextRoot);
uiManager.setButtonCallback("inventoryButton", [this](const std::string&) {
openInventory();
});
}
}
+1
View File
@@ -88,6 +88,7 @@ namespace ZL {
std::shared_ptr<UiNode> phoneScreenRoot;
std::shared_ptr<UiNode> journalScreenRoot;
std::shared_ptr<UiNode> inventoryRoot;
std::shared_ptr<UiNode> newInventoryRoot;
std::shared_ptr<UiNode> questJournalRoot;
int selectedQuestIndex = -1;