Fixing minor bugs, added about screen

This commit is contained in:
Vladislav Khorev 2026-07-15 20:22:12 +03:00
parent 159fac02f0
commit b6cd17449f
11 changed files with 257 additions and 22 deletions

View File

@ -656,7 +656,7 @@
"type": "Line",
"speaker": "Алик",
"portrait": "resources/dialogue/portrait_student_boy.png",
"text": "За зданием универа есть контейнер с кучей бумажного мусора и макулатурой.",
"text": "Возле здания универа лежит куча строительного мусора и макулатуры.",
"next": "line_14"
},
{

View File

@ -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": "Скорее всего, курсовая до сих пор лежит где-то там.",

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

Binary file not shown.

View File

@ -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",

BIN
resources/w/ui_en/img/main/aboutPage002.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -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
}
]
}
}

View File

@ -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",

View File

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

View File

@ -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&) {

View File

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

View File

@ -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