Working on inventory

This commit is contained in:
Vladislav Khorev 2026-05-28 17:16:10 +03:00
parent dda9f34277
commit 90c57932ec
16 changed files with 617 additions and 399 deletions

View File

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

View File

@ -1,81 +0,0 @@
{
"root": {
"type": "FrameLayout",
"name": "inventory_root",
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "FrameLayout",
"name": "inventory_items_panel",
"x": 50.0,
"y": 150.0,
"width": 320.0,
"height": 420.0,
"children": [
{
"type": "StaticImage",
"name": "panel_background",
"x": 0.0,
"y": 0.0,
"width": 320.0,
"height": 420.0,
"texture": "resources/w/red.png"
},
{
"type": "TextView",
"name": "inventory_title_text",
"x": 20.0,
"y": 18.0,
"width": 230.0,
"height": 34.0,
"text": "Inventory",
"fontSize": 24,
"fontPath": "resources/fonts/DroidSans.ttf",
"centered": false,
"topAligned": true,
"paddingX": 0.0,
"paddingY": 0.0,
"color": [1.0, 1.0, 1.0, 1.0]
},
{
"type": "TextView",
"name": "inventory_items_text",
"x": 20.0,
"y": 70.0,
"width": 280.0,
"height": 320.0,
"text": "Inventory (Empty)",
"fontSize": 18,
"fontPath": "resources/fonts/DroidSans.ttf",
"centered": false,
"topAligned": true,
"wrap": true,
"paddingX": 0.0,
"paddingY": 0.0,
"maxLines": 14,
"color": [1.0, 1.0, 1.0, 1.0]
},
{
"type": "TextButton",
"name": "close_inventory_button",
"x": 266.0,
"y": 16.0,
"width": 40.0,
"height": 40.0,
"text": "X",
"fontSize": 20,
"fontPath": "resources/fonts/DroidSans.ttf",
"textCentered": true,
"color": [1.0, 1.0, 1.0, 1.0],
"textures": {
"normal": "resources/w/blue.png",
"hover": "resources/w/blue.png",
"pressed": "resources/w/blue.png"
}
}
]
}
]
}
}

View File

@ -1,43 +0,0 @@
{
"root": {
"type": "FrameLayout",
"name": "hud_root",
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "LinearLayout",
"orientation": "vertical",
"vertical_align": "center",
"horizontal_align": "center",
"spacing": 0,
"width": "match_parent",
"height": 600,
"children": [
{
"type": "Button",
"name": "phoneButton",
"width": 229,
"height": 229,
"textures": {
"normal": "resources/w/ui/img/Phone001_State=Default.png",
"hover": "resources/w/ui/img/Phone001_State=Selected.png",
"pressed": "resources/w/ui/img/Phone001_State=Tap.png"
}
},
{
"type": "Button",
"name": "journalButton",
"width": 229,
"height": 229,
"textures": {
"normal": "resources/w/ui/img/Phone001_State=Default.png",
"hover": "resources/w/ui/img/Phone001_State=Selected.png",
"pressed": "resources/w/ui/img/Phone001_State=Tap.png"
}
}
]
}]
}
}

View File

@ -48,10 +48,10 @@
"name": "settingsButton", "name": "settingsButton",
"horizontal_gravity": "right", "horizontal_gravity": "right",
"vertical_gravity": "top", "vertical_gravity": "top",
"x": -60, "x": -23,
"y": -60, "y": -35,
"width": 352, "width": 200,
"height": 352, "height": 200,
"clickZoneWidth": 176, "clickZoneWidth": 176,
"clickZoneHeight": 176, "clickZoneHeight": 176,
"textures": { "textures": {
@ -59,23 +59,6 @@
"hover": "resources/w/ui/img/Settings001_State=Selected001.png", "hover": "resources/w/ui/img/Settings001_State=Selected001.png",
"pressed": "resources/w/ui/img/Settings001_State=Tap001.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", "type": "StaticImage",

View File

@ -1,45 +1,47 @@
{ {
"root": { "root": {
"type": "FrameLayout", "type": "FrameLayout",
"name": "hud_root", "name": "hud_root",
"width": "match_parent", "width": "match_parent",
"height": "match_parent", "height": "match_parent",
"children": [ "children": [
{ {
"type": "LinearLayout", "type": "LinearLayout",
"orientation": "vertical", "orientation": "vertical",
"vertical_align": "center", "vertical_align": "center",
"horizontal_align": "center", "horizontal_align": "center",
"spacing": 0, "spacing": 0,
"width": "match_parent", "width": "match_parent",
"height": 600, "height": 600,
"y" : 300, "y": 300,
"children": [ "children": [
{ {
"type": "StaticImage", "type": "StaticImage",
"name": "hint2", "name": "hint2",
"width": 440, "width": 440,
"height": 134, "height": 134,
"horizontal_gravity": "center", "horizontal_gravity": "center",
"texture": "resources/w/ui/img/Hint2.png", "texture": "resources/w/ui/img/Hint2.png",
"pulse": { "pulse": {
"minScale": 0.92, "minScale": 0.92,
"maxScale": 1.08, "maxScale": 1.08,
"periodMs": 1500 "periodMs": 1500
}, },
"fadeIn": { "durationMs": 600 } "fadeIn": {
} "durationMs": 600
] }
}, }
{ ]
},
{
"type": "Button", "type": "Button",
"name": "settingsButton", "name": "settingsButton",
"horizontal_gravity": "right", "horizontal_gravity": "right",
"vertical_gravity": "top", "vertical_gravity": "top",
"x": -60, "x": -23,
"y": -60, "y": -35,
"width": 352, "width": 200,
"height": 352, "height": 200,
"clickZoneWidth": 176, "clickZoneWidth": 176,
"clickZoneHeight": 176, "clickZoneHeight": 176,
"textures": { "textures": {
@ -48,32 +50,16 @@
"pressed": "resources/w/ui/img/Settings001_State=Tap001.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", "type": "StaticImage",
"name": "location", "name": "location",
"width": 380, "width": 380,
"height": 64, "height": 64,
"y" : 30, "y": 30,
"horizontal_gravity": "center", "horizontal_gravity": "center",
"vertical_align": "top", "vertical_align": "top",
"texture": "resources/w/ui/img/Location_dorm.png" "texture": "resources/w/ui/img/Location_dorm.png"
}] }
} ]
} }
}

View File

@ -1,35 +1,65 @@
{ {
"root": { "root": {
"type": "FrameLayout", "type": "FrameLayout",
"name": "hud_root", "name": "hud_root",
"width": "match_parent", "width": "match_parent",
"height": "match_parent", "height": "match_parent",
"children": [ "children": [
{ {
"type": "LinearLayout", "type": "LinearLayout",
"orientation": "vertical", "orientation": "vertical",
"vertical_align": "center", "vertical_align": "center",
"horizontal_align": "center", "horizontal_align": "center",
"spacing": 0, "spacing": 0,
"width": "match_parent", "width": "match_parent",
"height": 600, "height": 600,
"y" : 300, "y": 300,
"children": [ "children": [
{ {
"type": "StaticImage",
"name": "hint3",
"width": 692,
"height": 312,
"horizontal_gravity": "center",
"texture": "resources/w/ui/img/Hint3.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}
]
},
{
"type": "Button",
"name": "settingsButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": -23,
"y": -35,
"width": 200,
"height": 200,
"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": "StaticImage", "type": "StaticImage",
"name": "hint3", "name": "location",
"width": 692, "width": 380,
"height": 312, "height": 64,
"horizontal_gravity": "center", "y": 30,
"texture": "resources/w/ui/img/Hint3.png", "horizontal_gravity": "center",
"pulse": { "vertical_align": "top",
"minScale": 0.92, "texture": "resources/w/ui/img/Location_dorm.png"
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": { "durationMs": 600 }
} }
] ]
}] }
} }
}

View File

@ -1,35 +1,65 @@
{ {
"root": { "root": {
"type": "FrameLayout", "type": "FrameLayout",
"name": "hud_root", "name": "hud_root",
"width": "match_parent", "width": "match_parent",
"height": "match_parent", "height": "match_parent",
"children": [ "children": [
{ {
"type": "LinearLayout", "type": "LinearLayout",
"orientation": "vertical", "orientation": "vertical",
"vertical_align": "center", "vertical_align": "center",
"horizontal_align": "center", "horizontal_align": "center",
"spacing": 0, "spacing": 0,
"width": "match_parent", "width": "match_parent",
"height": 600, "height": 600,
"y" : 300, "y": 300,
"children": [ "children": [
{ {
"type": "StaticImage",
"name": "hint4",
"width": 440,
"height": 134,
"horizontal_gravity": "center",
"texture": "resources/w/ui/img/Hint4.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}
]
},
{
"type": "Button",
"name": "settingsButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": -23,
"y": -35,
"width": 200,
"height": 200,
"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": "StaticImage", "type": "StaticImage",
"name": "hint4", "name": "location",
"width": 440, "width": 380,
"height": 134, "height": 64,
"horizontal_gravity": "center", "y": 30,
"texture": "resources/w/ui/img/Hint4.png", "horizontal_gravity": "center",
"pulse": { "vertical_align": "top",
"minScale": 0.92, "texture": "resources/w/ui/img/Location_dorm.png"
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": { "durationMs": 600 }
} }
] ]
}] }
} }
}

View File

@ -1,35 +1,65 @@
{ {
"root": { "root": {
"type": "FrameLayout", "type": "FrameLayout",
"name": "hud_root", "name": "hud_root",
"width": "match_parent", "width": "match_parent",
"height": "match_parent", "height": "match_parent",
"children": [ "children": [
{ {
"type": "LinearLayout", "type": "LinearLayout",
"orientation": "vertical", "orientation": "vertical",
"vertical_align": "center", "vertical_align": "center",
"horizontal_align": "center", "horizontal_align": "center",
"spacing": 0, "spacing": 0,
"width": "match_parent", "width": "match_parent",
"height": 600, "height": 600,
"y" : 300, "y": 300,
"children": [ "children": [
{ {
"type": "StaticImage",
"name": "hint5",
"width": 692,
"height": 312,
"horizontal_gravity": "center",
"texture": "resources/w/ui/img/Hint5.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}
]
},
{
"type": "Button",
"name": "settingsButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": -23,
"y": -35,
"width": 200,
"height": 200,
"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": "StaticImage", "type": "StaticImage",
"name": "hint5", "name": "location",
"width": 692, "width": 380,
"height": 312, "height": 64,
"horizontal_gravity": "center", "y": 30,
"texture": "resources/w/ui/img/Hint5.png", "horizontal_gravity": "center",
"pulse": { "vertical_align": "top",
"minScale": 0.92, "texture": "resources/w/ui/img/Location_dorm.png"
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": { "durationMs": 600 }
} }
] ]
}] }
} }
}

View File

@ -13,8 +13,8 @@
"spacing": 0, "spacing": 0,
"width": "match_parent", "width": "match_parent",
"height": 600, "height": 600,
"y" : -250, "y": -250,
"x" : 300, "x": 300,
"children": [ "children": [
{ {
"type": "StaticImage", "type": "StaticImage",
@ -34,24 +34,67 @@
} }
] ]
}, },
{ {
"type": "Button", "type": "Button",
"name": "phoneButton", "name": "phoneButton",
"horizontal_gravity": "right", "horizontal_gravity": "right",
"vertical_gravity": "top", "vertical_gravity": "bottom",
"x": -46, "x": -46,
"y" :-46, "y": -46,
"width": 229, "width": 229,
"height": 229, "height": 229,
"clickZoneWidth": 104, "clickZoneWidth": 104,
"clickZoneHeight": 104, "clickZoneHeight": 104,
"textures": { "textures": {
"normal": "resources/w/ui/img/Phone001_State=Default.png", "normal": "resources/w/ui/img/Phone001_State=Default.png",
"hover": "resources/w/ui/img/Phone001_State=Selected.png", "hover": "resources/w/ui/img/Phone001_State=Selected.png",
"pressed": "resources/w/ui/img/Phone001_State=Tap.png" "pressed": "resources/w/ui/img/Phone001_State=Tap.png"
} }
} },
{
"type": "Button",
"name": "settingsButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": -23,
"y": -35,
"width": 200,
"height": 200,
"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": 110,
"y": -18,
"width": 165,
"height": 165,
"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"
}
] ]
} }
} }

View File

@ -0,0 +1,132 @@
{
"root": {
"type": "FrameLayout",
"name": "hud_root",
"width": "match_parent",
"height": "match_parent",
"children": [
{
"type": "LinearLayout",
"orientation": "horizontal",
"vertical_align": "center",
"horizontal_align": "right",
"spacing": 16,
"width": "match_parent",
"height": 600,
"y": -200,
"children": [
{
"type": "StaticImage",
"name": "hint6a",
"width": 440,
"height": 134,
"horizontal_gravity": "center",
"texture": "resources/w/ui/img/Hint6a.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
},
{
"type": "StaticImage",
"name": "hint6b",
"width": 440,
"height": 134,
"horizontal_gravity": "center",
"texture": "resources/w/ui/img/Hint6b.png",
"pulse": {
"minScale": 0.92,
"maxScale": 1.08,
"periodMs": 1500
},
"fadeIn": {
"durationMs": 600
}
}
]
},
{
"type": "Button",
"name": "phoneButton",
"horizontal_gravity": "right",
"vertical_gravity": "bottom",
"x": -46,
"y": -46,
"width": 229,
"height": 229,
"clickZoneWidth": 104,
"clickZoneHeight": 104,
"textures": {
"normal": "resources/w/ui/img/Phone001_State=Default.png",
"hover": "resources/w/ui/img/Phone001_State=Selected.png",
"pressed": "resources/w/ui/img/Phone001_State=Tap.png"
}
},
{
"type": "Button",
"name": "settingsButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": -23,
"y": -35,
"width": 200,
"height": 200,
"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": 110,
"y": -18,
"width": 165,
"height": 165,
"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": "Button",
"name": "journalButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": 220,
"y": -18,
"width": 165,
"height": 165,
"clickZoneWidth": 89,
"clickZoneHeight": 89,
"textures": {
"normal": "resources/w/ui/img/Journal001_State=Default.png",
"hover": "resources/w/ui/img/Journal001_State=Selected.png",
"pressed": "resources/w/ui/img/Journal001_State=Tap.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"
}
]
}
}

View File

@ -1,54 +1,99 @@
{ {
"root": { "root": {
"type": "FrameLayout", "type": "FrameLayout",
"name": "hud_root", "name": "hud_root",
"width": "match_parent", "width": "match_parent",
"height": "match_parent", "height": "match_parent",
"children": [ "children": [
{ {
"type": "LinearLayout", "type": "LinearLayout",
"orientation": "vertical", "orientation": "vertical",
"vertical_align": "center", "vertical_align": "center",
"horizontal_align": "center", "horizontal_align": "center",
"spacing": 0, "spacing": 0,
"width": "match_parent", "width": "match_parent",
"height": 600, "height": 600,
"y" : -250, "y": -250,
"children": [ "children": [
{ {
"type": "StaticImage", "type": "StaticImage",
"name": "hint6b", "name": "hint6b",
"width": 440, "width": 440,
"height": 134, "height": 134,
"horizontal_gravity": "center", "horizontal_gravity": "center",
"texture": "resources/w/ui/img/Hint6b.png", "texture": "resources/w/ui/img/Hint6b.png",
"pulse": { "pulse": {
"minScale": 0.92, "minScale": 0.92,
"maxScale": 1.08, "maxScale": 1.08,
"periodMs": 1500 "periodMs": 1500
}, },
"fadeIn": { "durationMs": 600 } "fadeIn": {
} "durationMs": 600
]
},
{
"type": "Button",
"name": "journalButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": -13,
"y" :-13,
"width": 163,
"height": 163,
"clickZoneWidth": 89,
"clickZoneHeight": 89,
"horizontal_gravity": "right",
"vertical_gravity": "top",
"textures": {
"normal": "resources/w/ui/img/Journal001_State=Default.png",
"hover": "resources/w/ui/img/Journal001_State=Selected.png",
"pressed": "resources/w/ui/img/Journal001_State=Tap.png"
} }
}] }
} ]
} },
{
"type": "Button",
"name": "settingsButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": -23,
"y": -35,
"width": 200,
"height": 200,
"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": 110,
"y": -18,
"width": 165,
"height": 165,
"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": "Button",
"name": "journalButton",
"horizontal_gravity": "right",
"vertical_gravity": "top",
"x": 220,
"y": -18,
"width": 165,
"height": 165,
"clickZoneWidth": 89,
"clickZoneHeight": 89,
"textures": {
"normal": "resources/w/ui/img/Journal001_State=Default.png",
"hover": "resources/w/ui/img/Journal001_State=Selected.png",
"pressed": "resources/w/ui/img/Journal001_State=Tap.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"
}
]
}
}

View File

@ -519,6 +519,7 @@ namespace ZL
renderer.shaderManager.PushShader(defaultShaderName); renderer.shaderManager.PushShader(defaultShaderName);
renderer.RenderUniform1i(textureUniformName, 0); renderer.RenderUniform1i(textureUniformName, 0);
renderer.RenderUniform1f("uAlpha", 1.0);
float width = Environment::projectionWidth; float width = Environment::projectionWidth;
float height = Environment::projectionHeight; float height = Environment::projectionHeight;
@ -749,6 +750,7 @@ namespace ZL
case SDLK_l: case SDLK_l:
//x = x - 1; //x = x - 1;
//std::cout << "current x: " << x << std::endl; //std::cout << "current x: " << x << std::endl;
std::cout << "Azimuth: " << currentLocation->cameraAzimuth << std::endl; std::cout << "Azimuth: " << currentLocation->cameraAzimuth << std::endl;
std::cout << "Inclination: " << currentLocation->cameraInclination << std::endl; std::cout << "Inclination: " << currentLocation->cameraInclination << std::endl;
break; break;

View File

@ -32,6 +32,7 @@ namespace ZL {
void MenuManager::setup(Inventory& inv, const std::string& zipFile) { void MenuManager::setup(Inventory& inv, const std::string& zipFile) {
inventory = &inv; inventory = &inv;
zipFile_ = zipFile;
//hudRoot = loadUiFromFile("resources/config2/hud.json", renderer, zipFile); //hudRoot = loadUiFromFile("resources/config2/hud.json", renderer, zipFile);
hudRoot = loadUiFromFile("resources/w/ui/hud_step0.json", renderer, zipFile); hudRoot = loadUiFromFile("resources/w/ui/hud_step0.json", renderer, zipFile);
@ -44,7 +45,6 @@ namespace ZL {
hudStep5abRoot = loadUiFromFile("resources/w/ui/hud_step5ab.json", renderer, zipFile); hudStep5abRoot = loadUiFromFile("resources/w/ui/hud_step5ab.json", renderer, zipFile);
phoneScreenRoot = loadUiFromFile("resources/w/ui/screen_phone.json", renderer, zipFile); phoneScreenRoot = loadUiFromFile("resources/w/ui/screen_phone.json", renderer, zipFile);
journalScreenRoot= loadUiFromFile("resources/w/ui/screen_journal.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); newInventoryRoot = loadUiFromFile("resources/w/ui/screen_inventory.json", renderer, zipFile);
questJournalRoot = loadUiFromFile("resources/config2/ui_quest_journal.json", renderer, zipFile); questJournalRoot = loadUiFromFile("resources/config2/ui_quest_journal.json", renderer, zipFile);
@ -76,26 +76,71 @@ namespace ZL {
uiManager.pushMenuFromSavedRoot(newInventoryRoot); uiManager.pushMenuFromSavedRoot(newInventoryRoot);
uiManager.setButtonCallback("inventoryExitButton", [this](const std::string&) { uiManager.setButtonCallback("inventoryExitButton", [this](const std::string&) {
closeInventory(); closeInventory();
}); });
/*
uiManager.pushMenuFromSavedRoot(inventoryRoot);
uiManager.setTextButtonCallback("close_inventory_button", [this](const std::string&) {
closeInventory();
});
const auto& items = inventory->getItems(); const auto& items = inventory->getItems();
std::string itemText; const int maxSlots = 7;
if (items.empty()) {
itemText = "Inventory (Empty)"; for (int i = 0; i < maxSlots; ++i) {
} const std::string btnName = "item" + std::to_string(i + 1) + "Button";
else { if (i < static_cast<int>(items.size())) {
itemText = "Inventory (" + std::to_string(items.size()) + " items)\n\n"; uiManager.setNodeVisible(btnName, true);
for (size_t i = 0; i < items.size(); ++i) {
itemText += std::to_string(i + 1) + ". " + items[i].name + "\n"; auto btn = uiManager.findButton(btnName);
if (btn) {
auto tex = renderer.textureManager.LoadFromPng(items[i].icon, zipFile_, true);
btn->texNormal = btn->texHover = btn->texPressed = tex;
}
uiManager.setButtonCallback(btnName, [this, i](const std::string&) {
selectInventoryItem(i);
});
} else {
uiManager.setNodeVisible(btnName, false);
} }
} }
uiManager.setText("inventory_items_text", itemText);*/
inventorySelectedIndex_ = -1;
if (!items.empty()) {
selectInventoryItem(0);
}
}
void MenuManager::selectInventoryItem(int index) {
const auto& items = inventory->getItems();
if (index < 0 || index >= static_cast<int>(items.size())) return;
// Revert previously selected button to its regular icon
if (inventorySelectedIndex_ >= 0 && inventorySelectedIndex_ < static_cast<int>(items.size())) {
const std::string prevBtnName = "item" + std::to_string(inventorySelectedIndex_ + 1) + "Button";
auto prevBtn = uiManager.findButton(prevBtnName);
if (prevBtn) {
auto tex = renderer.textureManager.LoadFromPng(items[inventorySelectedIndex_].icon, zipFile_, true);
prevBtn->texNormal = prevBtn->texHover = prevBtn->texPressed = tex;
}
}
inventorySelectedIndex_ = index;
const auto& item = items[index];
// Highlight newly selected button with its selected icon
const std::string btnName = "item" + std::to_string(index + 1) + "Button";
auto btn = uiManager.findButton(btnName);
if (btn) {
const std::string& selPath = item.selectedIcon.empty() ? item.icon : item.selectedIcon;
auto tex = renderer.textureManager.LoadFromPng(selPath, zipFile_, true);
btn->texNormal = btn->texHover = btn->texPressed = tex;
}
// Update the large selected picture on the right panel
auto img = uiManager.findStaticImage("selectedItemPic");
if (img) {
const std::string& path = item.selectedIcon.empty() ? item.icon : item.selectedIcon;
img->texture = renderer.textureManager.LoadFromPng(path, zipFile_, true);
}
uiManager.setText("selectedText", item.name);
uiManager.setText("selectedDescription", item.description);
} }
void MenuManager::closeInventory() { void MenuManager::closeInventory() {
@ -180,6 +225,11 @@ namespace ZL {
// and hides any hints that have already been completed. // and hides any hints that have already been completed.
// Called after every replaceRoot during step 5. // Called after every replaceRoot during step 5.
void MenuManager::setupStep5Callbacks() { void MenuManager::setupStep5Callbacks() {
if (uiManager.findButton("inventoryButton")) {
uiManager.setButtonCallback("inventoryButton", [this](const std::string&) {
openInventory();
});
}
if (uiManager.findButton("phoneButton")) { if (uiManager.findButton("phoneButton")) {
uiManager.setButtonCallback("phoneButton", [this](const std::string&) { uiManager.setButtonCallback("phoneButton", [this](const std::string&) {
openPhoneScreen(); openPhoneScreen();

View File

@ -66,11 +66,14 @@ namespace ZL {
void enterGameplay(); void enterGameplay();
void refreshQuestJournalUi(); void refreshQuestJournalUi();
void selectQuestByIndex(int index); void selectQuestByIndex(int index);
void selectInventoryItem(int index);
void refreshItemPickupHud(); void refreshItemPickupHud();
void setupStep5Callbacks(); void setupStep5Callbacks();
GameState state = GameState::Gameplay; GameState state = GameState::Gameplay;
Inventory* inventory = nullptr; Inventory* inventory = nullptr;
std::string zipFile_;
int inventorySelectedIndex_ = -1;
bool tutorialPhonePickedUp = false; bool tutorialPhonePickedUp = false;
bool tutorialJournalPickedUp = false; bool tutorialJournalPickedUp = false;
@ -87,7 +90,6 @@ namespace ZL {
std::shared_ptr<UiNode> hudStep5abRoot; std::shared_ptr<UiNode> hudStep5abRoot;
std::shared_ptr<UiNode> phoneScreenRoot; std::shared_ptr<UiNode> phoneScreenRoot;
std::shared_ptr<UiNode> journalScreenRoot; std::shared_ptr<UiNode> journalScreenRoot;
std::shared_ptr<UiNode> inventoryRoot;
std::shared_ptr<UiNode> newInventoryRoot; std::shared_ptr<UiNode> newInventoryRoot;
std::shared_ptr<UiNode> questJournalRoot; std::shared_ptr<UiNode> questJournalRoot;

View File

@ -11,6 +11,7 @@ namespace ZL {
std::string name; std::string name;
std::string description; std::string description;
std::string icon; std::string icon;
std::string selectedIcon;
Item() = default; Item() = default;
Item(const std::string& _id, const std::string& _name, const std::string& _desc, const std::string& _icon) Item(const std::string& _id, const std::string& _name, const std::string& _desc, const std::string& _icon)

View File

@ -54,6 +54,7 @@ void ItemRegistry::loadFromJson(const std::string& jsonPath, const std::string&
entry.value("description", ""), entry.value("description", ""),
entry.value("icon", "") entry.value("icon", "")
); );
item.selectedIcon = entry.value("selectedIcon", "");
items_[id] = std::move(item); items_[id] = std::move(item);
} }