From 0b4df8ab2d8894cbc6081175bdc31a3bf1a0e787 Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Thu, 25 Jun 2026 17:30:58 +0300 Subject: [PATCH] Working on portrait mode --- resources/w/ui/portrait_screen_phone.json | 126 +++++++++ .../w/ui/portrait_screen_phone_bank.json | 75 +++++ .../w/ui/portrait_screen_phone_chat_list.json | 245 ++++++++++++++++ ...rtrait_screen_phone_chat_list_hint001.json | 264 ++++++++++++++++++ .../w/ui/portrait_screen_phone_hint001.json | 164 +++++++++++ .../ui/portrait_screen_phone_hint001_002.json | 202 ++++++++++++++ .../w/ui/portrait_screen_phone_hint002.json | 164 +++++++++++ .../w/ui/portrait_screen_phone_map_dorm.json | 64 +++++ .../w/ui/portrait_screen_phone_map_uni.json | 64 +++++ .../w/ui/portrait_screen_phone_video.json | 64 +++++ src/Game.cpp | 5 + src/MenuManager.cpp | 127 +++++++-- src/MenuManager.h | 22 ++ 13 files changed, 1558 insertions(+), 28 deletions(-) create mode 100644 resources/w/ui/portrait_screen_phone.json create mode 100644 resources/w/ui/portrait_screen_phone_bank.json create mode 100644 resources/w/ui/portrait_screen_phone_chat_list.json create mode 100644 resources/w/ui/portrait_screen_phone_chat_list_hint001.json create mode 100644 resources/w/ui/portrait_screen_phone_hint001.json create mode 100644 resources/w/ui/portrait_screen_phone_hint001_002.json create mode 100644 resources/w/ui/portrait_screen_phone_hint002.json create mode 100644 resources/w/ui/portrait_screen_phone_map_dorm.json create mode 100644 resources/w/ui/portrait_screen_phone_map_uni.json create mode 100644 resources/w/ui/portrait_screen_phone_video.json diff --git a/resources/w/ui/portrait_screen_phone.json b/resources/w/ui/portrait_screen_phone.json new file mode 100644 index 0000000..4422e8d --- /dev/null +++ b/resources/w/ui/portrait_screen_phone.json @@ -0,0 +1,126 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "StaticImage", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "texture": "resources/w/ui/img/phone2/Phone002.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeDay", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 637.5, + "height": 172, + "texture": "resources/w/ui/img/phone2/ClockDay001.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeNight", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 446.25, + "height": 120.4, + "texture": "resources/w/ui/img/phone2/ClockNight001.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeDawn", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 446.25, + "height": 120.4, + "texture": "resources/w/ui/img/phone2/ClockMorning001.png" + }, + { + "type": "Button", + "name": "phoneBank", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -110, + "y": -60, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconBank001.png", + "hover": "resources/w/ui/img/phone2/IconBank001.png", + "pressed": "resources/w/ui/img/phone2/IconBank001.png" + } + }, + { + "type": "Button", + "name": "phoneTaxi", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": 110, + "y": -60, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconTaxi001.png", + "hover": "resources/w/ui/img/phone2/IconTaxi001.png", + "pressed": "resources/w/ui/img/phone2/IconTaxi001.png" + } + }, + { + "type": "Button", + "name": "phoneVideo", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": 110, + "y": -240, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconVideo001.png", + "hover": "resources/w/ui/img/phone2/IconVideo001.png", + "pressed": "resources/w/ui/img/phone2/IconVideo001.png" + } + }, + { + "type": "Button", + "name": "phoneMessenger", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -110, + "y": -240, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconMessenger001.png", + "hover": "resources/w/ui/img/phone2/IconMessenger001.png", + "pressed": "resources/w/ui/img/phone2/IconMessenger001.png" + } + } + ] + } +} \ No newline at end of file diff --git a/resources/w/ui/portrait_screen_phone_bank.json b/resources/w/ui/portrait_screen_phone_bank.json new file mode 100644 index 0000000..9aa1518 --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_bank.json @@ -0,0 +1,75 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "StaticImage", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "texture": "resources/w/ui/img/phoneBank/PhoneBank002.png" + }, + { + "type": "Button", + "name": "buttonBack", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 420, + "x": -240, + "width": 136, + "height": 136, + "textures": { + "normal": "resources/w/ui/img/phoneBank/PhoneBankBack002.png", + "hover": "resources/w/ui/img/phoneBank/PhoneBankBack002.png", + "pressed": "resources/w/ui/img/phoneBank/PhoneBankBack002.png" + } + }, + { + "type": "TextView", + "name": "balanceText", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -20, + "y": 200, + "width": 380, + "height": 80, + "text": "5 500 сом", + "fontSize": 60, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "paddingX": 0.0, + "paddingY": 0.0, + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ] + } + ] + } +} \ No newline at end of file diff --git a/resources/w/ui/portrait_screen_phone_chat_list.json b/resources/w/ui/portrait_screen_phone_chat_list.json new file mode 100644 index 0000000..76bdca2 --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_chat_list.json @@ -0,0 +1,245 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "Button", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "textures": { + "normal": "resources/w/ui/img/phone/PhoneChatList001.png", + "hover": "resources/w/ui/img/phone/PhoneChatList001.png", + "pressed": "resources/w/ui/img/phone/PhoneChatList001.png" + } + }, + { + "type": "LinearLayout", + "orientation": "vertical", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "spacing": 0, + "x": 0, + "y": 0, + "width": 637.5, + "height": 800, + "children": [ + { + "type": "FrameLayout", + "name": "chat1frame", + "width": 637.5, + "height": 126, + "children": [ + { + "type": "TextButton", + "name": "chat1button", + "x": 0.0, + "y": 0.0, + "width": 637.5, + "height": 126, + "text": "Айпери", + "textPaddingY": 16.0, + "textPaddingX": 128.0, + "fontSize": 40, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "textures": { + "normal": "resources/w/ui/img/phone/ChatListItem001.png", + "hover": "resources/w/ui/img/phone/ChatListItem001.png", + "pressed": "resources/w/ui/img/phone/ChatListItem001.png" + } + }, + { + "type": "StaticImage", + "name": "chat1Unread", + "x": 570, + "y": 50, + "width": 41, + "height": 41, + "texture": "resources/w/ui/img/phone/ChatListUnread1.png" + }, + { + "type": "TextView", + "name": "chat1msg", + "x": 128.0, + "y": 60.0, + "width": 637.5, + "height": 126, + "text": "Бекзат, помнишь мы ски...", + "fontSize": 32, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 0.8, + 0.8, + 0.8, + 1.0 + ] + } + ] + }, + { + "type": "FrameLayout", + "name": "chat2frame", + "width": 637.5, + "height": 126, + "children": [ + { + "type": "TextButton", + "name": "chat2button", + "x": 0.0, + "y": 0.0, + "width": 637.5, + "height": 126, + "text": "Атам", + "textPaddingY": 16.0, + "textPaddingX": 128.0, + "fontSize": 40, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "textures": { + "normal": "resources/w/ui/img/phone/ChatListItem002.png", + "hover": "resources/w/ui/img/phone/ChatListItem002.png", + "pressed": "resources/w/ui/img/phone/ChatListItem002.png" + } + }, + { + "type": "StaticImage", + "name": "chat2Unread", + "x": 570, + "y": 50, + "width": 41, + "height": 41, + "texture": "resources/w/ui/img/phone/ChatListUnread1.png" + }, + { + "type": "TextView", + "name": "chat2msg", + "x": 128.0, + "y": 60.0, + "width": 637.5, + "height": 126, + "text": "Бекзат, сынок, мы c мамой...", + "fontSize": 32, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 0.8, + 0.8, + 0.8, + 1.0 + ] + } + ] + }, + { + "type": "FrameLayout", + "name": "chat3frame", + "width": 637.5, + "height": 126, + "children": [ + { + "type": "TextButton", + "name": "chat3button", + "x": 0.0, + "y": 0.0, + "width": 637.5, + "height": 126, + "text": "БишкекНовости", + "textPaddingY": 16.0, + "textPaddingX": 128.0, + "fontSize": 40, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "textures": { + "normal": "resources/w/ui/img/phone/ChatListItem003.png", + "hover": "resources/w/ui/img/phone/ChatListItem003.png", + "pressed": "resources/w/ui/img/phone/ChatListItem003.png" + } + }, + { + "type": "StaticImage", + "name": "chat3Unread", + "x": 570, + "y": 50, + "width": 41, + "height": 41, + "texture": "resources/w/ui/img/phone/ChatListUnread1.png" + }, + { + "type": "TextView", + "name": "chat3msg", + "x": 128.0, + "y": 60.0, + "width": 637.5, + "height": 124, + "text": "Жители Бишкека все чаще...", + "fontSize": 32, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 0.8, + 0.8, + 0.8, + 1.0 + ] + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/resources/w/ui/portrait_screen_phone_chat_list_hint001.json b/resources/w/ui/portrait_screen_phone_chat_list_hint001.json new file mode 100644 index 0000000..3a4d1fe --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_chat_list_hint001.json @@ -0,0 +1,264 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "StaticImage", + "name": "hint_m002", + "width": 400, + "height": 156, + "x": 420, + "y": 0, + "horizontal_gravity": "center", + "vertical_gravity": "top", + "texture": "resources/w/ui/img/Hint_m001.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + }, + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "Button", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "textures": { + "normal": "resources/w/ui/img/phone/PhoneChatList001.png", + "hover": "resources/w/ui/img/phone/PhoneChatList001.png", + "pressed": "resources/w/ui/img/phone/PhoneChatList001.png" + } + }, + { + "type": "LinearLayout", + "orientation": "vertical", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "spacing": 0, + "x": 0, + "y": 0, + "width": 637.5, + "height": 800, + "children": [ + { + "type": "FrameLayout", + "name": "chat1frame", + "width": 637.5, + "height": 126, + "children": [ + { + "type": "TextButton", + "name": "chat1button", + "x": 0.0, + "y": 0.0, + "width": 637.5, + "height": 126, + "text": "Айпери", + "textPaddingY": 16.0, + "textPaddingX": 128.0, + "fontSize": 40, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "textures": { + "normal": "resources/w/ui/img/phone/ChatListItem001.png", + "hover": "resources/w/ui/img/phone/ChatListItem001.png", + "pressed": "resources/w/ui/img/phone/ChatListItem001.png" + } + }, + { + "type": "StaticImage", + "name": "chat1Unread", + "x": 570, + "y": 50, + "width": 41, + "height": 41, + "texture": "resources/w/ui/img/phone/ChatListUnread1.png" + }, + { + "type": "TextView", + "name": "chat1msg", + "x": 128.0, + "y": 60.0, + "width": 637.5, + "height": 126, + "text": "Бекзат, помнишь мы ски...", + "fontSize": 32, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 0.8, + 0.8, + 0.8, + 1.0 + ] + } + ] + }, + { + "type": "FrameLayout", + "name": "chat2frame", + "width": 637.5, + "height": 126, + "children": [ + { + "type": "TextButton", + "name": "chat2button", + "x": 0.0, + "y": 0.0, + "width": 637.5, + "height": 126, + "text": "Атам", + "textPaddingY": 16.0, + "textPaddingX": 128.0, + "fontSize": 40, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "textures": { + "normal": "resources/w/ui/img/phone/ChatListItem002.png", + "hover": "resources/w/ui/img/phone/ChatListItem002.png", + "pressed": "resources/w/ui/img/phone/ChatListItem002.png" + } + }, + { + "type": "StaticImage", + "name": "chat2Unread", + "x": 570, + "y": 50, + "width": 41, + "height": 41, + "texture": "resources/w/ui/img/phone/ChatListUnread1.png" + }, + { + "type": "TextView", + "name": "chat2msg", + "x": 128.0, + "y": 60.0, + "width": 637.5, + "height": 126, + "text": "Бекзат, сынок, мы c мамой...", + "fontSize": 32, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 0.8, + 0.8, + 0.8, + 1.0 + ] + } + ] + }, + { + "type": "FrameLayout", + "name": "chat3frame", + "width": 637.5, + "height": 126, + "children": [ + { + "type": "TextButton", + "name": "chat3button", + "x": 0.0, + "y": 0.0, + "width": 637.5, + "height": 126, + "text": "БишкекНовости", + "textPaddingY": 16.0, + "textPaddingX": 128.0, + "fontSize": 40, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 1.0, + 1.0, + 1.0, + 1.0 + ], + "textures": { + "normal": "resources/w/ui/img/phone/ChatListItem003.png", + "hover": "resources/w/ui/img/phone/ChatListItem003.png", + "pressed": "resources/w/ui/img/phone/ChatListItem003.png" + } + }, + { + "type": "StaticImage", + "name": "chat3Unread", + "x": 570, + "y": 50, + "width": 41, + "height": 41, + "texture": "resources/w/ui/img/phone/ChatListUnread1.png" + }, + { + "type": "TextView", + "name": "chat3msg", + "x": 128.0, + "y": 60.0, + "width": 637.5, + "height": 124, + "text": "Жители Бишкека все чаще...", + "fontSize": 32, + "fontPath": "resources/fonts/DroidSans.ttf", + "textCentered": false, + "topAligned": true, + "wrap": true, + "color": [ + 0.8, + 0.8, + 0.8, + 1.0 + ] + } + ] + } + ] + } + ] + } +} \ No newline at end of file diff --git a/resources/w/ui/portrait_screen_phone_hint001.json b/resources/w/ui/portrait_screen_phone_hint001.json new file mode 100644 index 0000000..9d47956 --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_hint001.json @@ -0,0 +1,164 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "StaticImage", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "texture": "resources/w/ui/img/phone2/Phone002.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeDay", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 637.5, + "height": 172, + "texture": "resources/w/ui/img/phone2/ClockDay001.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeNight", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 446.25, + "height": 120.4, + "texture": "resources/w/ui/img/phone2/ClockNight001.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeDawn", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 446.25, + "height": 120.4, + "texture": "resources/w/ui/img/phone2/ClockMorning001.png" + }, + { + "type": "Button", + "name": "phoneBank", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -110, + "y": -60, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconBank001.png", + "hover": "resources/w/ui/img/phone2/IconBank001.png", + "pressed": "resources/w/ui/img/phone2/IconBank001.png" + } + }, + { + "type": "Button", + "name": "phoneTaxi", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": 110, + "y": -60, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconTaxi001.png", + "hover": "resources/w/ui/img/phone2/IconTaxi001.png", + "pressed": "resources/w/ui/img/phone2/IconTaxi001.png" + } + }, + { + "type": "Button", + "name": "phoneVideo", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": 110, + "y": -240, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconVideo001.png", + "hover": "resources/w/ui/img/phone2/IconVideo001.png", + "pressed": "resources/w/ui/img/phone2/IconVideo001.png" + } + }, + { + "type": "Button", + "name": "phoneMessenger", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -110, + "y": -240, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconMessenger001.png", + "hover": "resources/w/ui/img/phone2/IconMessenger001.png", + "pressed": "resources/w/ui/img/phone2/IconMessenger001.png" + } + }, + { + "type": "StaticImage", + "name": "hint_m001arrow", + "width": 170, + "height": 48, + "x" : -220, + "y" : 150, + "horizontal_gravity": "center", + "vertical_gravity" : "bottom", + "texture": "resources/w/ui/img/hint_arrow_left.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + }, + { + "type": "StaticImage", + "name": "hint_m001", + "width": 414, + "height": 156, + "x" : -420, + "y" : 100, + "horizontal_gravity": "center", + "vertical_gravity" : "bottom", + "texture": "resources/w/ui/img/Hint_m002.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + } + ] + } +} diff --git a/resources/w/ui/portrait_screen_phone_hint001_002.json b/resources/w/ui/portrait_screen_phone_hint001_002.json new file mode 100644 index 0000000..0fb45cd --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_hint001_002.json @@ -0,0 +1,202 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "StaticImage", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "texture": "resources/w/ui/img/phone2/Phone002.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeDay", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 637.5, + "height": 172, + "texture": "resources/w/ui/img/phone2/ClockDay001.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeNight", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 446.25, + "height": 120.4, + "texture": "resources/w/ui/img/phone2/ClockNight001.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeDawn", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 446.25, + "height": 120.4, + "texture": "resources/w/ui/img/phone2/ClockMorning001.png" + }, + { + "type": "Button", + "name": "phoneBank", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -110, + "y": -60, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconBank001.png", + "hover": "resources/w/ui/img/phone2/IconBank001.png", + "pressed": "resources/w/ui/img/phone2/IconBank001.png" + } + }, + { + "type": "Button", + "name": "phoneTaxi", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": 110, + "y": -60, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconTaxi001.png", + "hover": "resources/w/ui/img/phone2/IconTaxi001.png", + "pressed": "resources/w/ui/img/phone2/IconTaxi001.png" + } + }, + { + "type": "Button", + "name": "phoneVideo", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": 110, + "y": -240, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconVideo001.png", + "hover": "resources/w/ui/img/phone2/IconVideo001.png", + "pressed": "resources/w/ui/img/phone2/IconVideo001.png" + } + }, + { + "type": "Button", + "name": "phoneMessenger", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -110, + "y": -240, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconMessenger001.png", + "hover": "resources/w/ui/img/phone2/IconMessenger001.png", + "pressed": "resources/w/ui/img/phone2/IconMessenger001.png" + } + }, + { + "type": "StaticImage", + "name": "hint_m001arrow", + "width": 170, + "height": 48, + "x": -220, + "y": 150, + "horizontal_gravity": "center", + "vertical_gravity": "bottom", + "texture": "resources/w/ui/img/hint_arrow_left.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + }, + { + "type": "StaticImage", + "name": "hint_m001", + "width": 414, + "height": 156, + "x": -420, + "y": 100, + "horizontal_gravity": "center", + "vertical_gravity": "bottom", + "texture": "resources/w/ui/img/Hint_m002.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + }, + { + "type": "StaticImage", + "name": "hint_m003arrow", + "width": 170, + "height": 48, + "x": 220, + "y": 270, + "horizontal_gravity": "center", + "vertical_gravity": "bottom", + "texture": "resources/w/ui/img/hint_arrow_right.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + }, + { + "type": "StaticImage", + "name": "hint_m003", + "width": 318, + "height": 178, + "x": 420, + "y": 220, + "horizontal_gravity": "center", + "vertical_gravity": "bottom", + "texture": "resources/w/ui/img/Hint_m003.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + } + ] + } +} diff --git a/resources/w/ui/portrait_screen_phone_hint002.json b/resources/w/ui/portrait_screen_phone_hint002.json new file mode 100644 index 0000000..6a1664b --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_hint002.json @@ -0,0 +1,164 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "StaticImage", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "texture": "resources/w/ui/img/phone2/Phone002.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeDay", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 637.5, + "height": 172, + "texture": "resources/w/ui/img/phone2/ClockDay001.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeNight", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 446.25, + "height": 120.4, + "texture": "resources/w/ui/img/phone2/ClockNight001.png" + }, + { + "type": "StaticImage", + "name": "phoneTimeDawn", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 446.25, + "height": 120.4, + "texture": "resources/w/ui/img/phone2/ClockMorning001.png" + }, + { + "type": "Button", + "name": "phoneBank", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -110, + "y": -60, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconBank001.png", + "hover": "resources/w/ui/img/phone2/IconBank001.png", + "pressed": "resources/w/ui/img/phone2/IconBank001.png" + } + }, + { + "type": "Button", + "name": "phoneTaxi", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": 110, + "y": -60, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconTaxi001.png", + "hover": "resources/w/ui/img/phone2/IconTaxi001.png", + "pressed": "resources/w/ui/img/phone2/IconTaxi001.png" + } + }, + { + "type": "Button", + "name": "phoneVideo", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": 110, + "y": -240, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconVideo001.png", + "hover": "resources/w/ui/img/phone2/IconVideo001.png", + "pressed": "resources/w/ui/img/phone2/IconVideo001.png" + } + }, + { + "type": "Button", + "name": "phoneMessenger", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "x": -110, + "y": -240, + "width": 170, + "height": 170, + "textures": { + "normal": "resources/w/ui/img/phone2/IconMessenger001.png", + "hover": "resources/w/ui/img/phone2/IconMessenger001.png", + "pressed": "resources/w/ui/img/phone2/IconMessenger001.png" + } + }, + { + "type": "StaticImage", + "name": "hint_m003arrow", + "width": 170, + "height": 48, + "x" : 220, + "y" : 270, + "horizontal_gravity": "center", + "vertical_gravity" : "bottom", + "texture": "resources/w/ui/img/hint_arrow_right.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + }, + { + "type": "StaticImage", + "name": "hint_m003", + "width": 318, + "height": 178, + "x" : 420, + "y" : 220, + "horizontal_gravity": "center", + "vertical_gravity" : "bottom", + "texture": "resources/w/ui/img/Hint_m003.png", + "pulse": { + "minScale": 0.92, + "maxScale": 1.08, + "periodMs": 1500 + }, + "fadeIn": { + "durationMs": 1000 + } + } + ] + } +} diff --git a/resources/w/ui/portrait_screen_phone_map_dorm.json b/resources/w/ui/portrait_screen_phone_map_dorm.json new file mode 100644 index 0000000..689a6a8 --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_map_dorm.json @@ -0,0 +1,64 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "StaticImage", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "texture": "resources/w/ui/img/phoneMap/PhoneMapDorm001.png" + }, + { + "type": "Button", + "name": "buttonBack", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 470, + "width": 638, + "height": 108, + "textures": { + "normal": "resources/w/ui/img/phoneMap/PhoneMapBack001.png", + "hover": "resources/w/ui/img/phoneMap/PhoneMapBack001.png", + "pressed": "resources/w/ui/img/phoneMap/PhoneMapBack001.png" + } + }, + { + "type": "Button", + "name": "mapGo", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -400, + "width": 568, + "height": 174, + "textures": { + "normal": "resources/w/ui/img/phoneMap/PhoneMapButton001.png", + "hover": "resources/w/ui/img/phoneMap/PhoneMapButton001.png", + "pressed": "resources/w/ui/img/phoneMap/PhoneMapButton001.png" + } + } + ] + } +} \ No newline at end of file diff --git a/resources/w/ui/portrait_screen_phone_map_uni.json b/resources/w/ui/portrait_screen_phone_map_uni.json new file mode 100644 index 0000000..80e6376 --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_map_uni.json @@ -0,0 +1,64 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "StaticImage", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "texture": "resources/w/ui/img/phoneMap/PhoneMapUni001.png" + }, + { + "type": "Button", + "name": "buttonBack", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 470, + "width": 638, + "height": 108, + "textures": { + "normal": "resources/w/ui/img/phoneMap/PhoneMapBack001.png", + "hover": "resources/w/ui/img/phoneMap/PhoneMapBack001.png", + "pressed": "resources/w/ui/img/phoneMap/PhoneMapBack001.png" + } + }, + { + "type": "Button", + "name": "mapGo", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -400, + "width": 568, + "height": 174, + "textures": { + "normal": "resources/w/ui/img/phoneMap/PhoneMapButton001.png", + "hover": "resources/w/ui/img/phoneMap/PhoneMapButton001.png", + "pressed": "resources/w/ui/img/phoneMap/PhoneMapButton001.png" + } + } + ] + } +} diff --git a/resources/w/ui/portrait_screen_phone_video.json b/resources/w/ui/portrait_screen_phone_video.json new file mode 100644 index 0000000..ada8c34 --- /dev/null +++ b/resources/w/ui/portrait_screen_phone_video.json @@ -0,0 +1,64 @@ +{ + "root": { + "type": "FrameLayout", + "name": "hud_root", + "width": "match_parent", + "height": "match_parent", + "vertical_align": "center", + "horizontal_align": "center", + "children": [ + { + "type": "Button", + "name": "phoneExitButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 0, + "width": "match_parent", + "height": "match_parent", + "textures": { + "normal": "resources/transparent.png", + "hover": "resources/transparent.png", + "pressed": "resources/transparent.png" + } + }, + { + "type": "StaticImage", + "name": "phoneMain", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -60, + "width": 882, + "height": 1416, + "texture": "resources/w/ui/img/phoneVideo/PhoneVideo003.png" + }, + { + "type": "Button", + "name": "buttonBack", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 470, + "width": 564, + "height": 82, + "textures": { + "normal": "resources/w/ui/img/phoneVideo/PhoneVideoBackButton001.png", + "hover": "resources/w/ui/img/phoneVideo/PhoneVideoBackButton001.png", + "pressed": "resources/w/ui/img/phoneVideo/PhoneVideoBackButton001.png" + } + }, + { + "type": "Button", + "name": "videoSkip", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -430, + "width": 582, + "height": 124, + "textures": { + "normal": "resources/w/ui/img/phoneVideo/PhoneVideoSkipButton001.png", + "hover": "resources/w/ui/img/phoneVideo/PhoneVideoSkipButton001.png", + "pressed": "resources/w/ui/img/phoneVideo/PhoneVideoSkipButton001.png" + } + } + ] + } +} \ No newline at end of file diff --git a/src/Game.cpp b/src/Game.cpp index a358838..9957f78 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -934,10 +934,15 @@ namespace ZL if (event.type == SDL_WINDOWEVENT && event.window.event == SDL_WINDOWEVENT_RESIZED) { // Обновляем размеры и сбрасываем кеш текстов, т.к. меши хранятся в пикселях + const bool wasPortrait = Environment::width < Environment::height; Environment::width = event.window.data1; Environment::height = event.window.data2; Environment::computeProjectionDimensions(); + const bool isPortrait = Environment::width < Environment::height; menuManager.uiManager.updateAllLayouts(); + if (wasPortrait != isPortrait) { + menuManager.onOrientationChanged(); + } std::cout << "Window resized: " << Environment::width << "x" << Environment::height << std::endl; //space.clearTextRendererCache(); diff --git a/src/MenuManager.cpp b/src/MenuManager.cpp index c81af3e..0ba7ae4 100644 --- a/src/MenuManager.cpp +++ b/src/MenuManager.cpp @@ -126,17 +126,29 @@ namespace ZL { hudCutsceneRoot_ = loadUiFromFile("resources/w/ui/hud_cutscene.json", renderer, zipFile); hudTopHintRoot_ = loadUiFromFile("resources/w/ui/hud_top_hint01.json", renderer, zipFile); - phoneMainRoot = loadUiFromFile("resources/w/ui/screen_phone.json", renderer, zipFile); - phoneMainHintARoot = loadUiFromFile("resources/w/ui/screen_phone_hint001.json", renderer, zipFile); - phoneMainHintBRoot = loadUiFromFile("resources/w/ui/screen_phone_hint002.json", renderer, zipFile); - phoneMainHintABRoot = loadUiFromFile("resources/w/ui/screen_phone_hint001_002.json", renderer, zipFile); + phoneMainRoot = loadUiFromFile("resources/w/ui/screen_phone.json", renderer, zipFile); + phoneMainHintARoot = loadUiFromFile("resources/w/ui/screen_phone_hint001.json", renderer, zipFile); + phoneMainHintBRoot = loadUiFromFile("resources/w/ui/screen_phone_hint002.json", renderer, zipFile); + phoneMainHintABRoot = loadUiFromFile("resources/w/ui/screen_phone_hint001_002.json", renderer, zipFile); - phoneBankRoot = loadUiFromFile("resources/w/ui/screen_phone_bank.json", renderer, zipFile); - phoneVideoRoot = loadUiFromFile("resources/w/ui/screen_phone_video.json", renderer, zipFile); - phoneMapDormRoot = loadUiFromFile("resources/w/ui/screen_phone_map_dorm.json", renderer, zipFile); - phoneMapUniRoot = loadUiFromFile("resources/w/ui/screen_phone_map_uni.json", renderer, zipFile); - phoneChatListRoot = loadUiFromFile("resources/w/ui/screen_phone_chat_list.json", renderer, zipFile); - phoneChatListHintRoot = loadUiFromFile("resources/w/ui/screen_phone_chat_list_hint001.json", renderer, zipFile); + phoneBankRoot = loadUiFromFile("resources/w/ui/screen_phone_bank.json", renderer, zipFile); + phoneVideoRoot = loadUiFromFile("resources/w/ui/screen_phone_video.json", renderer, zipFile); + phoneMapDormRoot = loadUiFromFile("resources/w/ui/screen_phone_map_dorm.json", renderer, zipFile); + phoneMapUniRoot = loadUiFromFile("resources/w/ui/screen_phone_map_uni.json", renderer, zipFile); + + verticalPhoneMainRoot = loadUiFromFile("resources/w/ui/portrait_screen_phone.json", renderer, zipFile); + verticalPhoneMainHintARoot = loadUiFromFile("resources/w/ui/portrait_screen_phone_hint001.json", renderer, zipFile); + verticalPhoneMainHintBRoot = loadUiFromFile("resources/w/ui/portrait_screen_phone_hint002.json", renderer, zipFile); + verticalPhoneMainHintABRoot= loadUiFromFile("resources/w/ui/portrait_screen_phone_hint001_002.json", renderer, zipFile); + verticalPhoneBankRoot = loadUiFromFile("resources/w/ui/portrait_screen_phone_bank.json", renderer, zipFile); + verticalPhoneVideoRoot = loadUiFromFile("resources/w/ui/portrait_screen_phone_video.json", renderer, zipFile); + verticalPhoneMapDormRoot = loadUiFromFile("resources/w/ui/portrait_screen_phone_map_dorm.json", renderer, zipFile); + verticalPhoneMapUniRoot = loadUiFromFile("resources/w/ui/portrait_screen_phone_map_uni.json", renderer, zipFile); + + phoneChatListRoot = loadUiFromFile("resources/w/ui/screen_phone_chat_list.json", renderer, zipFile); + phoneChatListHintRoot = loadUiFromFile("resources/w/ui/screen_phone_chat_list_hint001.json", renderer, zipFile); + verticalPhoneChatListRoot = loadUiFromFile("resources/w/ui/portrait_screen_phone_chat_list.json", renderer, zipFile); + verticalPhoneChatListHintRoot = loadUiFromFile("resources/w/ui/portrait_screen_phone_chat_list_hint001.json", renderer, zipFile); phoneChat1Root = loadUiFromFile("resources/w/ui/screen_phone_chat1.json", renderer, zipFile); phoneChat2Root = loadUiFromFile("resources/w/ui/screen_phone_chat2.json", renderer, zipFile); phoneChat3Root = loadUiFromFile("resources/w/ui/screen_phone_chat3.json", renderer, zipFile); @@ -161,7 +173,6 @@ namespace ZL { renderer.textureManager.LoadFromPng("resources/w/ui/img/toast/quest_completed001.png", zipFile, true); renderer.textureManager.LoadFromPng("resources/w/ui/img/toast/quest_failed001.png", zipFile, true); - gameState_.questJournal.onQuestUnlocked = [this](const std::string& id) { const Quest::QuestState* q = gameState_.questJournal.findQuest(id); if (q) showToast("resources/w/ui/img/toast/quest_new001.png", q->definition.title); @@ -567,21 +578,24 @@ namespace ZL { void MenuManager::openPhoneScreen() { uiState_ = GameUiState::PhoneScreen; + currentPhoneSubScreen_ = PhoneSubScreen::Main; - if (gameState_.tutorialNeedOpenTaxiScreen && (gameState_.tutorialPhoneChatScreenOpened == false)) - { + if (isPortraitMode()) { + if (gameState_.tutorialNeedOpenTaxiScreen && (gameState_.tutorialPhoneChatScreenOpened == false)) + uiManager.pushMenuFromSavedRoot(verticalPhoneMainHintABRoot); + else if (gameState_.tutorialNeedOpenTaxiScreen) + uiManager.pushMenuFromSavedRoot(verticalPhoneMainHintBRoot); + else if (gameState_.tutorialPhoneChatScreenOpened == false) + uiManager.pushMenuFromSavedRoot(verticalPhoneMainHintARoot); + else + uiManager.pushMenuFromSavedRoot(verticalPhoneMainRoot); + } else if (gameState_.tutorialNeedOpenTaxiScreen && (gameState_.tutorialPhoneChatScreenOpened == false)) { uiManager.pushMenuFromSavedRoot(phoneMainHintABRoot); - } - else if (gameState_.tutorialNeedOpenTaxiScreen) - { + } else if (gameState_.tutorialNeedOpenTaxiScreen) { uiManager.pushMenuFromSavedRoot(phoneMainHintBRoot); - } - else if (gameState_.tutorialPhoneChatScreenOpened == false) - { + } else if (gameState_.tutorialPhoneChatScreenOpened == false) { uiManager.pushMenuFromSavedRoot(phoneMainHintARoot); - } - else - { + } else { uiManager.pushMenuFromSavedRoot(phoneMainRoot); } @@ -625,14 +639,15 @@ namespace ZL { } void MenuManager::openPhoneMessenger() { + currentPhoneSubScreen_ = PhoneSubScreen::ChatList; if (gameState_.tutorialPhoneChatScreenOpened) { - uiManager.pushMenuFromSavedRoot(phoneChatListRoot); + uiManager.pushMenuFromSavedRoot(isPortraitMode() ? verticalPhoneChatListRoot : phoneChatListRoot); } else { - uiManager.pushMenuFromSavedRoot(phoneChatListHintRoot); + uiManager.pushMenuFromSavedRoot(isPortraitMode() ? verticalPhoneChatListHintRoot : phoneChatListHintRoot); } refreshChatUnreadIndicators(); @@ -680,7 +695,8 @@ namespace ZL { void MenuManager::openPhoneBank() { - uiManager.pushMenuFromSavedRoot(phoneBankRoot); + currentPhoneSubScreen_ = PhoneSubScreen::Bank; + uiManager.pushMenuFromSavedRoot(isPortraitMode() ? verticalPhoneBankRoot : phoneBankRoot); uiManager.setText("balanceText", formatMoney(gameState_.money)); uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) { @@ -693,7 +709,8 @@ namespace ZL { } void MenuManager::openPhoneVideo() { - uiManager.pushMenuFromSavedRoot(phoneVideoRoot); + currentPhoneSubScreen_ = PhoneSubScreen::Video; + uiManager.pushMenuFromSavedRoot(isPortraitMode() ? verticalPhoneVideoRoot : phoneVideoRoot); uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) { closePhoneEntirely(); @@ -729,9 +746,11 @@ namespace ZL { closePhoneEntirely(); if (startDialogueFunc) startDialogueFunc("dialog_taxi003"); } else if (gameState_.currentLocationName == "uni_exterior") { - openPhoneMapScreen(phoneMapUniRoot); + currentPhoneSubScreen_ = PhoneSubScreen::MapUni; + openPhoneMapScreen(isPortraitMode() ? verticalPhoneMapUniRoot : phoneMapUniRoot); } else { - openPhoneMapScreen(phoneMapDormRoot); + currentPhoneSubScreen_ = PhoneSubScreen::MapDorm; + openPhoneMapScreen(isPortraitMode() ? verticalPhoneMapDormRoot : phoneMapDormRoot); } } @@ -760,6 +779,7 @@ namespace ZL { void MenuManager::openPhoneChatFromList(int chatIndex, std::shared_ptr chatRoot) { activeChatIndex_ = chatIndex; + currentPhoneSubScreen_ = PhoneSubScreen::Chat; phoneChatVisibleBubbles_.clear(); gameState_.tutorialPhoneChatScreenOpened = true; uiManager.pushMenuFromSavedRoot(chatRoot); @@ -786,6 +806,7 @@ namespace ZL { trimChatPreview(gameState_.chatHistory[activeChatIndex_].back().text); } activeChatIndex_ = -1; + currentPhoneSubScreen_ = PhoneSubScreen::ChatList; phoneChatVisibleBubbles_.clear(); uiManager.popMenu(); uiManager.updateAllLayouts(); @@ -808,6 +829,7 @@ namespace ZL { trimChatPreview(gameState_.chatHistory[activeChatIndex_].back().text); } activeChatIndex_ = -1; + currentPhoneSubScreen_ = PhoneSubScreen::None; uiState_ = GameUiState::Gameplay; phoneChatVisibleBubbles_.clear(); const int depth = uiManager.menuStackSize(); @@ -1550,4 +1572,53 @@ namespace ZL { } } + bool MenuManager::isPortraitMode() const { + return Environment::projectionWidth < Environment::projectionHeight; + } + + void MenuManager::onOrientationChanged() { + if (uiState_ != GameUiState::PhoneScreen) return; + + const PhoneSubScreen savedSubScreen = currentPhoneSubScreen_; + const int savedChatIndex = activeChatIndex_; + + // Collapse all stacked phone menus and reopen in the new orientation. + activeChatIndex_ = -1; + phoneChatVisibleBubbles_.clear(); + const int depth = uiManager.menuStackSize(); + for (int i = 0; i < depth; ++i) uiManager.popMenu(); + uiState_ = GameUiState::Gameplay; + + switch (savedSubScreen) { + case PhoneSubScreen::Bank: + openPhoneScreen(); + openPhoneBank(); + break; + case PhoneSubScreen::Video: + openPhoneScreen(); + openPhoneVideo(); + break; + case PhoneSubScreen::MapDorm: + openPhoneScreen(); + openPhoneMapScreen(isPortraitMode() ? verticalPhoneMapDormRoot : phoneMapDormRoot); + currentPhoneSubScreen_ = PhoneSubScreen::MapDorm; + break; + case PhoneSubScreen::MapUni: + openPhoneScreen(); + openPhoneMapScreen(isPortraitMode() ? verticalPhoneMapUniRoot : phoneMapUniRoot); + currentPhoneSubScreen_ = PhoneSubScreen::MapUni; + break; + case PhoneSubScreen::ChatList: + case PhoneSubScreen::Chat: + openPhoneScreen(); + openPhoneMessenger(); + break; + default: + openPhoneScreen(); + break; + } + + uiManager.updateAllLayouts(); + } + } // namespace ZL diff --git a/src/MenuManager.h b/src/MenuManager.h index 6f2f605..a5dba17 100644 --- a/src/MenuManager.h +++ b/src/MenuManager.h @@ -93,6 +93,9 @@ namespace ZL { void onCutsceneFinished(); bool cutsceneHudActive_ = false; + // Called by Game when the window is resized and orientation has changed. + void onOrientationChanged(); + void saveSettings(); void loadSettings(); @@ -190,8 +193,20 @@ namespace ZL { std::shared_ptr phoneVideoRoot; std::shared_ptr phoneMapDormRoot; std::shared_ptr phoneMapUniRoot; + + // Portrait-mode (vertical) equivalents for screens that have a portrait layout + std::shared_ptr verticalPhoneMainRoot; + std::shared_ptr verticalPhoneMainHintARoot; + std::shared_ptr verticalPhoneMainHintBRoot; + std::shared_ptr verticalPhoneMainHintABRoot; + std::shared_ptr verticalPhoneBankRoot; + std::shared_ptr verticalPhoneVideoRoot; + std::shared_ptr verticalPhoneMapDormRoot; + std::shared_ptr verticalPhoneMapUniRoot; std::shared_ptr phoneChatListRoot; std::shared_ptr phoneChatListHintRoot; + std::shared_ptr verticalPhoneChatListRoot; + std::shared_ptr verticalPhoneChatListHintRoot; std::shared_ptr phoneChat1Root; std::shared_ptr phoneChat2Root; std::shared_ptr phoneChat3Root; @@ -216,6 +231,13 @@ namespace ZL { void applyCurrentHealthBar(); + bool isPortraitMode() const; + + // Tracks which phone sub-screen is currently shown so onOrientationChanged() + // can reopen the correct screen after swapping roots. + enum class PhoneSubScreen { None, Main, Bank, Video, MapDorm, MapUni, ChatList, Chat }; + PhoneSubScreen currentPhoneSubScreen_ = PhoneSubScreen::None; + // Phone chat UI state (transient — rebuilt from gameState_.chatHistory on open) struct PhoneChatBubbleInfo { std::string nodeName;