diff --git a/resources/dialogue/dorm_dialogues004.json b/resources/dialogue/dorm_dialogues004.json index 4497eff..ebe9810 100644 --- a/resources/dialogue/dorm_dialogues004.json +++ b/resources/dialogue/dorm_dialogues004.json @@ -656,7 +656,7 @@ "type": "Line", "speaker": "Алик", "portrait": "resources/dialogue/portrait_student_boy.png", - "text": "За зданием универа есть контейнер с кучей бумажного мусора и макулатурой.", + "text": "Возле здания универа лежит куча строительного мусора и макулатуры.", "next": "line_14" }, { diff --git a/resources/dialogue/translate_dialogues.json b/resources/dialogue/translate_dialogues.json index 1f69117..1896735 100644 --- a/resources/dialogue/translate_dialogues.json +++ b/resources/dialogue/translate_dialogues.json @@ -261,9 +261,9 @@ "en": "And where is her coursework now?" }, { - "key": "За зданием универа есть контейнер с кучей бумажного мусора и макулатурой.", - "ru": "За зданием универа есть контейнер с кучей бумажного мусора и макулатурой.", - "en": "Behind the university building there is a container with a pile of paper trash and waste." + "key": "Возле здания универа лежит куча строительного мусора и макулатуры.", + "ru": "Возле здания универа лежит куча строительного мусора и макулатуры.", + "en": "There is a pile of construction waste and paper near the university building." }, { "key": "Скорее всего, курсовая до сих пор лежит где-то там.", diff --git a/resources/w/ui/img/main/aboutPage002.png b/resources/w/ui/img/main/aboutPage002.png new file mode 100644 index 0000000..f5392e3 --- /dev/null +++ b/resources/w/ui/img/main/aboutPage002.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:7b15e59d027c5d7ff1e87862af49051b3974b6fc790aa7e41c19e971977355b9 +size 196609 diff --git a/resources/w/ui/screen_about.json b/resources/w/ui/screen_about.json index 21974f2..e531cd6 100644 --- a/resources/w/ui/screen_about.json +++ b/resources/w/ui/screen_about.json @@ -7,18 +7,61 @@ { "type": "StaticImage", "name": "aboutBkg", - "width": "match_parent", - "height": "match_parent", - "texture": "resources/w/ui/img/main/bkg.png" + "width": 2992, + "height": 1632, + "horizontal_gravity": "center", + "vertical_gravity": "center", + "texture": "resources/w/ui/img/main/MenuBkg001_v001.png" }, - { + { "type": "StaticImage", - "name": "aboutImage", + "name": "aboutPicture", + "width": 720, + "height": 720, + "horizontal_gravity": "center", + "vertical_gravity": "center", + "texture": "resources/w/ui/img/main/aboutPage002.png" + }, + { + "type": "TextButton", + "name": "steamButton", "horizontal_gravity": "center", "vertical_gravity": "center", - "width": 800, - "height": 500, - "texture": "resources/w/ui/img/main/about.png" + "y": 200, + "width": 200, + "height": 60, + "text": "Добавить игру в Wishlist!", + "fontSize": 40, + "color": [0.55, 0.9, 1.0, 1.0], + "textCentered": true + }, + { + "type": "TextButton", + "name": "telegramButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -240, + "x": -150, + "width": 200, + "height": 60, + "text": "Telegram-канал", + "fontSize": 40, + "color": [0.55, 0.9, 1.0, 1.0], + "textCentered": true + }, + { + "type": "TextButton", + "name": "discordButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -240, + "x": 150, + "width": 200, + "height": 60, + "text": "Наш Discord", + "fontSize": 40, + "color": [0.55, 0.9, 1.0, 1.0], + "textCentered": true }, { "type": "TextButton", diff --git a/resources/w/ui_en/img/main/aboutPage002.png b/resources/w/ui_en/img/main/aboutPage002.png new file mode 100644 index 0000000..bb59a00 --- /dev/null +++ b/resources/w/ui_en/img/main/aboutPage002.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:6b62f274b1127c7ac20af23268a42d45683d3c2ea59423e9994fe843b8fa9c64 +size 194719 diff --git a/resources/w/ui_en/screen_about.json b/resources/w/ui_en/screen_about.json new file mode 100644 index 0000000..c241777 --- /dev/null +++ b/resources/w/ui_en/screen_about.json @@ -0,0 +1,80 @@ +{ + "root": { + "type": "FrameLayout", + "width": "match_parent", + "height": "match_parent", + "children": [ + { + "type": "StaticImage", + "name": "aboutBkg", + "width": 2992, + "height": 1632, + "horizontal_gravity": "center", + "vertical_gravity": "center", + "texture": "resources/w/ui/img/main/MenuBkg001_v001.png" + }, + { + "type": "StaticImage", + "name": "aboutPicture", + "width": 720, + "height": 720, + "horizontal_gravity": "center", + "vertical_gravity": "center", + "texture": "resources/w/ui_en/img/main/aboutPage002.png" + }, + { + "type": "TextButton", + "name": "steamButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": 200, + "width": 200, + "height": 60, + "text": "Add to your Steam wishlist!", + "fontSize": 40, + "color": [0.55, 0.9, 1.0, 1.0], + "textCentered": true + }, + { + "type": "TextButton", + "name": "telegramButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -240, + "x": -150, + "width": 200, + "height": 60, + "text": "Telegram channel", + "fontSize": 40, + "color": [0.55, 0.9, 1.0, 1.0], + "textCentered": true + }, + { + "type": "TextButton", + "name": "discordButton", + "horizontal_gravity": "center", + "vertical_gravity": "center", + "y": -240, + "x": 150, + "width": 200, + "height": 60, + "text": "Our Discord", + "fontSize": 40, + "color": [0.55, 0.9, 1.0, 1.0], + "textCentered": true + }, + { + "type": "TextButton", + "name": "aboutBackButton", + "horizontal_gravity": "center", + "vertical_gravity": "bottom", + "y": 40, + "width": 200, + "height": 60, + "text": "Back", + "fontSize": 40, + "textCentered": true + } + ] + } +} diff --git a/resources/w/ui_en/screen_main_menu.json b/resources/w/ui_en/screen_main_menu.json index 40b95c8..78bf6c1 100644 --- a/resources/w/ui_en/screen_main_menu.json +++ b/resources/w/ui_en/screen_main_menu.json @@ -39,7 +39,7 @@ "width": 320, "height": 180, "y": 235, - "texture": "resources/w/ui/img/main/letters002.png" + "texture": "resources/w/ui_en/img/main/letters002.png" }, { "type": "LinearLayout", diff --git a/src/Game.cpp b/src/Game.cpp index 5da49a6..82a5554 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -78,11 +78,6 @@ namespace ZL } Game::~Game() { -#ifndef EMSCRIPTEN - // In Emscripten, SDL must stay alive across context loss/restore cycles - // so the window remains valid when the game object is re-created. - SDL_Quit(); -#endif } void Game::setup() { @@ -586,7 +581,7 @@ namespace ZL gameState.locations["uni_interior"]->requestClosePhone = [this]() { menuManager.closePhoneEntirely(); }; gameState.locations["uni_interior"]->requestReturnToMainMenu = [this]() { gameState.currentLocationName.clear(); - menuManager.showMainMenu(); + menuManager.showMenuAfterGameCompleted(); }; gameState.locations["uni_interior"]->requestSetChatUnread = [this](int idx, bool unread, const std::string& msg) { menuManager.setChatUnread(idx, unread, msg); @@ -656,7 +651,7 @@ namespace ZL }; gameState.locations["uni_exterior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); }; gameState.locations["uni_exterior"]->requestClosePhone = [this]() { menuManager.closePhoneEntirely(); }; - gameState.locations["uni_exterior"]->requestReturnToMainMenu = [this]() { menuManager.showMainMenu(); }; + //gameState.locations["uni_exterior"]->requestReturnToMainMenu = [this]() { menuManager.showMenuAfterGameCompleted(); }; gameState.locations["uni_exterior"]->requestSetChatUnread = [this](int idx, bool unread, const std::string& msg) { menuManager.setChatUnread(idx, unread, msg); }; @@ -740,7 +735,7 @@ namespace ZL gameState.locations["location_dorm"]->requestNightDayTransition = [this](bool isNight, bool isDawn) { gameState.isNight = isNight; gameState.isDawn = isDawn; }; gameState.locations["location_dorm"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); }; gameState.locations["location_dorm"]->requestClosePhone = [this]() { menuManager.closePhoneEntirely(); }; - gameState.locations["location_dorm"]->requestReturnToMainMenu = [this]() { menuManager.showMainMenu(); }; + //gameState.locations["location_dorm"]->requestReturnToMainMenu = [this]() { menuManager.showMenuAfterGameCompleted(); }; gameState.locations["location_dorm"]->requestSetChatUnread = [this](int idx, bool unread, const std::string& msg) { menuManager.setChatUnread(idx, unread, msg); }; diff --git a/src/MenuManager.cpp b/src/MenuManager.cpp index eace199..fedb314 100644 --- a/src/MenuManager.cpp +++ b/src/MenuManager.cpp @@ -16,6 +16,9 @@ namespace ZL { static const std::string EMPTY_LANGUAGE_RU = u8"(пусто)"; static const std::string EMPTY_LANGUAGE_EN = "(empty)"; + static const std::string BACK_TO_MAIN_MENU_RU = u8"Вернуться в меню"; + static const std::string BACK_TO_MAIN_MENU_EN = "Back to Main Menu"; + static int questStatusPriority(Quest::QuestStatus status) { switch (status) { @@ -385,6 +388,81 @@ namespace ZL { #endif } + void MenuManager::showMenuAfterGameCompleted() { + //gameState_.currentLocationName.clear(); + + audioPlayer_.crossFadeMusicAsync("audio/main menu final.ogg"); + + uiState_ = GameUiState::MainMenu; + uiManager.clearMenuStack(); + topUiManager.replaceRoot(nullptr); + topUiManager.clearMenuStack(); + uiManager.replaceRoot(mainMenuRoot); + + + + uiManager.setTextButtonCallback("menuStartButton", [this](const std::string&) { + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + enterGameplay(); + + }); + uiManager.setTextButtonCallback("menuAboutButton", [this](const std::string&) { + showAboutScreen(); + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + }); + uiManager.setTextButtonCallback("menuCreditsButton", [this](const std::string&) { + showCreditsScreen(); + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + }); + uiManager.setTextButtonCallback("menuSettingsButton", [this](const std::string&) { + showSettingsScreen(); + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + }); + uiManager.setTextButtonCallback("menuLanguageButton", [this](const std::string&) { + showLanguageScreen(); + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + }); + uiManager.setTextButtonCallback("menuLoadButton", [this](const std::string&) { + showLoadGameScreen(); + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + }); + + + +#ifndef EMSCRIPTEN + uiManager.setTextButtonCallback("menuExitButton", [this](const std::string&) { + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + Environment::exitGameLoop = true; + }); +#else + uiManager.setNodeVisible("menuExitButton", false); +#endif + + //Now open the about screen: + uiManager.pushMenuFromSavedRoot(aboutScreenRoot); + uiManager.findTextButton("aboutBackButton")->text = (g_currentLanguage == Language::Russian) ? BACK_TO_MAIN_MENU_RU : BACK_TO_MAIN_MENU_EN; + uiManager.setTextButtonCallback("aboutBackButton", [this](const std::string&) { + uiManager.popMenu(); + uiManager.updateAllLayouts(); + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + }); + + uiManager.setTextButtonCallback("steamButton", [this](const std::string&) { + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + SDL_OpenURL("https://store.steampowered.com/app/4801010/"); + }); + + uiManager.setTextButtonCallback("telegramButton", [this](const std::string&) { + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + SDL_OpenURL("https://telegram.me/fishrungames"); + }); + + uiManager.setTextButtonCallback("discordButton", [this](const std::string&) { + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + SDL_OpenURL("https://discord.gg/S8jgGHXjw"); + }); + } + void MenuManager::showAboutScreen() { uiManager.pushMenuFromSavedRoot(aboutScreenRoot); uiManager.setTextButtonCallback("aboutBackButton", [this](const std::string&) { @@ -392,6 +470,21 @@ namespace ZL { uiManager.updateAllLayouts(); audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); }); + + uiManager.setTextButtonCallback("steamButton", [this](const std::string&) { + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + SDL_OpenURL("https://store.steampowered.com/app/4801010/"); + }); + + uiManager.setTextButtonCallback("telegramButton", [this](const std::string&) { + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + SDL_OpenURL("https://telegram.me/fishrungames"); + }); + + uiManager.setTextButtonCallback("discordButton", [this](const std::string&) { + audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + SDL_OpenURL("https://discord.gg/S8jgGHXjw"); + }); } void MenuManager::showCreditsScreen() { @@ -402,6 +495,7 @@ namespace ZL { audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); }); + uiManager.stopAnimationOnNode("creditsLinearLayout", "slowScroll"); uiManager.resetAnimationOnNode("creditsLinearLayout"); uiManager.startAnimationOnNode("creditsLinearLayout", "slowScroll"); @@ -510,7 +604,7 @@ namespace ZL { void MenuManager::showSettingsGraphicsScreen() { uiManager.pushMenuFromSavedRoot(settingsGraphicsScreenRoot); uiManager.setTextButtonCallback("settingsBackButton", [this](const std::string&) { - //saveSettings(); + saveSettings(); uiManager.popMenu(); audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); }); @@ -550,6 +644,8 @@ namespace ZL { Environment::setFullscreen(!Environment::isFullscreen); refreshFullscreenToggle(); audioPlayer_.playSoundAsync("audio/751089__smallconfusion__mechanical-plastic-click-11.ogg"); + uiManager.updateAllLayouts(); + topUiManager.updateAllLayouts(); }); uiManager.setTextButtonCallback("shadowToggleButton", [this, refreshShadowToggle](const std::string&) { diff --git a/src/MenuManager.h b/src/MenuManager.h index 0e09171..8f2d909 100644 --- a/src/MenuManager.h +++ b/src/MenuManager.h @@ -53,6 +53,7 @@ namespace ZL { bool isQuestJournalOpen() const { return uiState_ == GameUiState::QuestJournal; } void showMainMenu(); + void showMenuAfterGameCompleted(); bool isMainMenuOpen() const { return uiState_ == GameUiState::MainMenu; } void openPhoneScreen(); diff --git a/src/main.cpp b/src/main.cpp index 9360b7d..a3956d4 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -356,8 +356,10 @@ int main(int argc, char* argv[]) { #endif } + //ZL::logger() << "Quitting step 1: " << std::endl; // Явное уничтожение объекта игры ДО завершения работы Steamworks delete g_game; + //ZL::logger() << "Quitting step 2: " << std::endl; g_game = nullptr; } catch (const std::exception& e) @@ -377,19 +379,31 @@ int main(int argc, char* argv[]) { } } + //ZL::logger() << "Quitting step 3: " << std::endl; + #ifdef STEAMSDK // Деинициализация Steamworks происходит только тогда, когда все объекты игры гарантированно уничтожены SteamAPI_Shutdown(); #endif + //ZL::logger() << "Quitting step 4: " << std::endl; // Очистка ресурсов SDL if (ctx) { + //ZL::logger() << "Quitting step 5: " << std::endl; SDL_GL_DeleteContext(ctx); } + //ZL::logger() << "Quitting step 6: " << std::endl; if (ZL::Environment::window) { + //ZL::logger() << "Quitting step 7: " << std::endl; SDL_DestroyWindow(ZL::Environment::window); } + //ZL::logger() << "Quitting step 8: " << std::endl; +#ifndef EMSCRIPTEN + // In Emscripten, SDL must stay alive across context loss/restore cycles + // so the window remains valid when the game object is re-created. SDL_Quit(); +#endif + //ZL::logger() << "Quitting step 9: " << std::endl; return 0; } #endif