Working on UI

This commit is contained in:
Vladislav Khorev committed 2026-05-30 22:27:09 +03:00
1 parent 9425f9b19a
commit a0550daf4b
6 files changed
+111 -23

No files matched your search

+46 -9
View File
@@ -81,9 +81,9 @@ namespace ZL {
hudStep5aRoot = loadUiFromFile("resources/w/ui/hud_step5a.json", renderer, zipFile);
hudStep5bRoot = loadUiFromFile("resources/w/ui/hud_step5b.json", renderer, zipFile);
hudStep5abRoot = loadUiFromFile("resources/w/ui/hud_step5ab.json", renderer, zipFile);
//phoneScreenRoot = loadUiFromFile("resources/w/ui/screen_phone_chat_list.json", renderer, zipFile);
phoneScreenRoot = loadUiFromFile("resources/w/ui/screen_phone_chat2.json", renderer, zipFile);
//phoneScreenRoot = loadUiFromFile("resources/w/ui/screen_phone_chat1.json", renderer, zipFile);
phoneChatListRoot = loadUiFromFile("resources/w/ui/screen_phone_chat_list.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);
newInventoryRoot = loadUiFromFile("resources/w/ui/screen_inventory.json", renderer, zipFile);
questJournalRoot = loadUiFromFile("resources/w/ui/screen_journal.json", renderer, zipFile);
@@ -197,20 +197,57 @@ namespace ZL {
void MenuManager::openPhoneScreen() {
state = GameState::PhoneScreen;
tutorialPhoneScreenOpened = true;
// Hide the phone hint on the current HUD so it stays hidden when we return.
uiManager.setNodeVisible("hint6a", false);
uiManager.pushMenuFromSavedRoot(phoneScreenRoot);
uiManager.pushMenuFromSavedRoot(phoneChatListRoot);
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneScreen();
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setTextButtonCallback("chat1button", [this](const std::string&) {
openPhoneChatFromList(phoneChat1Root, "dialog_chat_parents001");
});
uiManager.setTextButtonCallback("chat2button", [this](const std::string&) {
openPhoneChatFromList(phoneChat2Root, "dialog_chat_aiperi001");
});
uiManager.setTextButtonCallback("chat3button", [this](const std::string&) {
// not yet implemented
});
}
// Reset chat state and start the dialogue
void MenuManager::openPhoneChatFromList(std::shared_ptr<UiNode> chatRoot, const std::string& dialogueId) {
phoneChatVisibleBubbles_.clear();
resetPhoneChatNodes();
if (startDialogueFunc) {
startDialogueFunc("dialog_chat_aiperi001");
uiManager.pushMenuFromSavedRoot(chatRoot);
const bool firstOpen = dialogueId.empty() || startedDialogues_.find(dialogueId) == startedDialogues_.end();
if (firstOpen) {
resetPhoneChatNodes();
}
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneScreenFromChat();
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setTextButtonCallback("chatTitleButton", [this](const std::string&) {
returnToPhoneChatList();
});
if (firstOpen && startDialogueFunc && !dialogueId.empty()) {
startedDialogues_.insert(dialogueId);
startDialogueFunc(dialogueId);
}
}
void MenuManager::returnToPhoneChatList() {
phoneChatVisibleBubbles_.clear();
uiManager.popMenu();
}
void MenuManager::closePhoneScreenFromChat() {
state = GameState::Gameplay;
phoneChatVisibleBubbles_.clear();
uiManager.popMenu();
uiManager.popMenu();
}
void MenuManager::closePhoneScreen() {