Working on inventory

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

View File

@ -4,43 +4,43 @@
"id": "phone",
"name": "Телефон",
"description": "Я не могу себе представить жизнь без своего телефона.",
"icon": "resources/fire2.png"
"icon": "resources/w/ui/img/inv/ItemPhone001.png"
},
{
"id": "journal",
"name": "Журнал",
"description": "Это мой журнал куда я вношу свои заметки.",
"icon": "resources/fire2.png"
"icon": "resources/w/ui/img/inv/ItemJournal001.png"
},
{
"id": "knife",
"name": "Серебряный нож",
"description": "Этот серебряный нож я одолжил у Айпери, и я должен его вернуть.",
"icon": "resources/fire2.png"
"icon": "resources/w/ui/img/inv/ItemKnife001.png"
},
{
"id": "book",
"name": "Книга",
"description": "Это книга о манасчи Жусупе Мамае.",
"icon": "resources/fire2.png"
"icon": "resources/w/ui/img/inv/ItemBook001.png"
},
{
"id": "note_spell",
"name": "Записка",
"description": "Тут написано \"Прочитай вслух когда настанет ночь, сквозь двери сможешь ты пройти.\" и текст заклинания.",
"icon": "resources/fire2.png"
"icon": "resources/w/ui/img/inv/ItemNote001.png"
},
{
"id": "report_card",
"name": "Зачетка Бегимай",
"description": "Это зачетная книжка Бегимай. Сюда нужно поставить оценку за курсовую работу.",
"icon": "resources/fire2.png"
"icon": "resources/w/ui/img/inv/ItemSelReportCard001.png"
},
{
"id": "coursework",
"name": "Курсовая Бегимай",
"description": "Это курсовая работа Бегимай, из-за которой она выбросилась из окна.",
"icon": "resources/fire2.png"
"icon": "resources/w/ui/img/inv/ItemCoursework001.png"
}
]
}

View File

@ -37,6 +37,7 @@
"name": "hint2",
"width": 24,
"height": 118,
"y" : 20,
"horizontal_gravity": "center",
"texture": "resources/w/ui/img/hint_arrow_down.png"
}

View File

@ -30,6 +30,50 @@
"fadeIn": { "durationMs": 600 }
}
]
}]
},
{
"type": "Button",
"name": "settingsButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": -60,
"y": -60,
"width": 352,
"height": 352,
"clickZoneWidth": 176,
"clickZoneHeight": 176,
"textures": {
"normal": "resources/w/ui/img/Settings001_State=Default001.png",
"hover": "resources/w/ui/img/Settings001_State=Selected001.png",
"pressed": "resources/w/ui/img/Settings001_State=Tap001.png"
}
},
{
"type": "Button",
"name": "inventoryButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": 160,
"y": -48,
"width": 326,
"height": 326,
"clickZoneWidth": 151,
"clickZoneHeight": 151,
"textures": {
"normal": "resources/w/ui/img/Inventory001_State=Default001.png",
"hover": "resources/w/ui/img/Inventory001_State=Selected001.png",
"pressed": "resources/w/ui/img/Inventory001_State=Tap001.png"
}
},
{
"type": "StaticImage",
"name": "location",
"width": 380,
"height": 64,
"y" : 30,
"horizontal_gravity": "center",
"vertical_align": "top",
"texture": "resources/w/ui/img/Location_dorm.png"
}]
}
}

BIN
resources/w/ui/img/Close001_State=Default.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/Close001_State=Selected.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/Close001_State=Tap.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/Inventory001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/InventoryAllButton001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemBook001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemCoursework001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemJournal001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemKnife001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemNote001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemPhone001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemReportCard001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemSelBook001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemSelCoursework001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemSelJournal001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemSelKnife001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemSelNote001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemSelPhone001.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
resources/w/ui/img/inv/ItemSelReportCard001.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,201 @@
{
"root": {
"type": "FrameLayout",
"name": "hud_root",
"width": "match_parent",
"height": "match_parent",
"vertical_align": "center",
"horizontal_align": "center",
"children": [
{
"type": "StaticImage",
"name": "background",
"width": 1266,
"height": 585,
"horizontal_gravity": "center",
"vertical_gravity": "center",
"texture": "resources/w/ui/img/Inventory001.png"
},
{
"type": "StaticImage",
"name": "allItems",
"width": 110,
"height": 67,
"x" : -570,
"y" : 200,
"horizontal_gravity": "center",
"vertical_gravity": "center",
"texture": "resources/w/ui/img/inv/InventoryAllButton001.png"
},
{
"type": "Button",
"name": "inventoryExitButton",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"width": 90,
"height": 90,
"x" : 580,
"y" : 240,
"textures": {
"normal": "resources/w/ui/img/Close001_State=Default.png",
"hover": "resources/w/ui/img/Close001_State=Selected.png",
"pressed": "resources/w/ui/img/Close001_State=Tap.png"
}
},
{
"type": "Button",
"name": "item1Button",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"width": 137,
"height": 137,
"x" : -580,
"y" : 90,
"textures": {
"normal": "resources/w/ui/img/inv/ItemSelPhone001.png",
"hover": "resources/w/ui/img/inv/ItemSelPhone001.png",
"pressed": "resources/w/ui/img/inv/ItemSelPhone001.png"
}
},
{
"type": "Button",
"name": "item2Button",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"width": 137,
"height": 137,
"x" : -480,
"y" : 90,
"textures": {
"normal": "resources/w/ui/img/inv/ItemJournal001.png",
"hover": "resources/w/ui/img/inv/ItemJournal001.png",
"pressed": "resources/w/ui/img/inv/ItemJournal001.png"
}
},
{
"type": "Button",
"name": "item3Button",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"width": 137,
"height": 137,
"x" : -380,
"y" : 90,
"textures": {
"normal": "resources/w/ui/img/inv/ItemKnife001.png",
"hover": "resources/w/ui/img/inv/ItemKnife001.png",
"pressed": "resources/w/ui/img/inv/ItemKnife001.png"
}
},
{
"type": "Button",
"name": "item4Button",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"width": 137,
"height": 137,
"x" : -580,
"y" : -10,
"textures": {
"normal": "resources/w/ui/img/inv/ItemNote001.png",
"hover": "resources/w/ui/img/inv/ItemNote001.png",
"pressed": "resources/w/ui/img/inv/ItemNote001.png"
}
},
{
"type": "Button",
"name": "item5Button",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"width": 137,
"height": 137,
"x" : -480,
"y" : -10,
"textures": {
"normal": "resources/w/ui/img/inv/ItemCoursework001.png",
"hover": "resources/w/ui/img/inv/ItemCoursework001.png",
"pressed": "resources/w/ui/img/inv/ItemCoursework001.png"
}
},
{
"type": "Button",
"name": "item6Button",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"width": 137,
"height": 137,
"x" : -380,
"y" : -10,
"textures": {
"normal": "resources/w/ui/img/inv/ItemReportCard001.png",
"hover": "resources/w/ui/img/inv/ItemReportCard001.png",
"pressed": "resources/w/ui/img/inv/ItemReportCard001.png"
}
},
{
"type": "Button",
"name": "item7Button",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"width": 137,
"height": 137,
"x" : -580,
"y" : -110,
"textures": {
"normal": "resources/w/ui/img/inv/ItemBook001.png",
"hover": "resources/w/ui/img/inv/ItemBook001.png",
"pressed": "resources/w/ui/img/inv/ItemBook001.png"
}
},
{
"type": "StaticImage",
"name": "selectedItemPic",
"width": 137,
"height": 137,
"x" : -260,
"y" : 90,
"horizontal_gravity": "center",
"vertical_gravity": "center",
"texture": "resources/w/ui/img/inv/ItemSelReportCard001.png"
},
{
"type": "TextView",
"name": "selectedText",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"x" : 250,
"y" : 40,
"width": 900,
"height": 137,
"text": "Серебряный нож.",
"fontSize": 24,
"fontPath": "resources/fonts/DroidSans.ttf",
"centered": false,
"topAligned": true,
"wrap": true,
"paddingX": 0.0,
"paddingY": 0.0,
"color": [0.318, 0.635, 1.0, 1.0]
},
{
"type": "TextView",
"name": "selectedDescription",
"horizontal_gravity": "center",
"vertical_gravity": "center",
"x" : 150,
"y" : -100,
"width": 900,
"height": 137,
"text": "А все бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут бегут а мы идем.",
"fontSize": 24,
"fontPath": "resources/fonts/DroidSans.ttf",
"centered": false,
"topAligned": true,
"wrap": true,
"paddingX": 0.0,
"paddingY": 0.0,
"color": [1.0, 1.0, 1.0, 1.0]
}
]
}
}

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();
});
}
}

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;