Working on phone

This commit is contained in:
Vladislav Khorev 2026-06-03 22:27:18 +03:00
parent 7a02665305
commit 1b1ceac2fe
7 changed files with 194 additions and 12 deletions

View File

@ -318,6 +318,24 @@
"type": "End"
}
]
},
{
"id": "dialog_taxi002",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/dialogue/portrait_hero_neutral.png",
"text": "Я заказал такси до универа, машина уже ждет!",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "dialog_second_floor001",

View File

@ -27,7 +27,7 @@
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/dialogue/portrait_hero_neutral.png",
"text": "Это мусорный контейнер, я не буду в нем копаться!",
"text": "Это куча строительного мусора, я не буду в ней копаться!",
"next": "end_1"
},
{
@ -69,7 +69,61 @@
"type": "End"
}
]
},
{
"id": "dialog_contaier003",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/dialogue/portrait_hero_neutral.png",
"text": "Я уже нашел в этой куче мусора то, что мне нужно.",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "dialog_taxi001",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/dialogue/portrait_hero_neutral.png",
"text": "Прежде чем выходить за ворота, я должен заказать такси до общаги.",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
{
"id": "dialog_taxi002",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/dialogue/portrait_hero_neutral.png",
"text": "Я заказал такси до общаги, машина уже ждет!",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
},
],
"cutscenes": [
{

View File

@ -1083,6 +1083,24 @@
"type": "End"
}
]
},
{
"id": "dialog_taxi003",
"start": "line_1",
"nodes": [
{
"id": "line_1",
"type": "Line",
"speaker": "Бекзат",
"portrait": "resources/dialogue/portrait_hero_neutral.png",
"text": "Чтобы заказать такси, я сначала должен выйти на улицу.",
"next": "end_1"
},
{
"id": "end_1",
"type": "End"
}
]
}
],
"cutscenes": [

View File

@ -89,9 +89,11 @@ namespace ZL {
hudUniExtDarkRoot = loadUiFromFile("resources/w/ui/hud_uni_ext_dark.json", renderer, zipFile);
//phoneChatListRoot = loadUiFromFile("resources/w/ui/screen_phone_bank.json", renderer, zipFile);
//phoneChatListRoot = loadUiFromFile("resources/w/ui/screen_phone_map_dorm.json", renderer, zipFile);
//phoneChatListRoot = loadUiFromFile("resources/w/ui/screen_phone_video.json", renderer, zipFile);
phoneMainRoot = loadUiFromFile("resources/w/ui/screen_phone.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);
phoneChat1Root = loadUiFromFile("resources/w/ui/screen_phone_chat1.json", renderer, zipFile);
phoneChat2Root = loadUiFromFile("resources/w/ui/screen_phone_chat2.json", renderer, zipFile);
@ -269,10 +271,30 @@ namespace ZL {
state = GameState::PhoneScreen;
tutorialPhoneScreenOpened = true;
uiManager.setNodeVisible("hint6a", false);
uiManager.pushMenuFromSavedRoot(phoneMainRoot);
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
});
uiManager.setButtonCallback("phoneMessenger", [this](const std::string&) {
openPhoneMessenger();
});
uiManager.setButtonCallback("phoneBank", [this](const std::string&) {
openPhoneBank();
});
uiManager.setButtonCallback("phoneVideo", [this](const std::string&) {
openPhoneVideo();
});
uiManager.setButtonCallback("phoneTaxi", [this](const std::string&) {
openPhoneTaxi();
});
}
void MenuManager::openPhoneMessenger() {
uiManager.pushMenuFromSavedRoot(phoneChatListRoot);
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneScreen();
closePhoneEntirely();
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setTextButtonCallback("chat1button", [this](const std::string&) {
@ -286,6 +308,58 @@ namespace ZL {
});
}
void MenuManager::openPhoneBank() {
uiManager.pushMenuFromSavedRoot(phoneBankRoot);
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
});
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
uiManager.popMenu();
});
}
void MenuManager::openPhoneVideo() {
uiManager.pushMenuFromSavedRoot(phoneVideoRoot);
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
});
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
uiManager.popMenu();
});
uiManager.setButtonCallback("videoSkip", [this](const std::string&) {
// TODO: trigger time-skip game feature
closePhoneEntirely();
});
}
void MenuManager::openPhoneTaxi() {
if (currentLocationName_ == "uni_interior") {
closePhoneEntirely();
if (startDialogueFunc) startDialogueFunc("dialog_taxi003");
} else if (currentLocationName_ == "uni_exterior") {
openPhoneMapScreen(phoneMapUniRoot);
} else {
openPhoneMapScreen(phoneMapDormRoot);
}
}
void MenuManager::openPhoneMapScreen(std::shared_ptr<UiNode> mapRoot) {
uiManager.pushMenuFromSavedRoot(mapRoot);
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
});
uiManager.setButtonCallback("buttonBack", [this](const std::string&) {
uiManager.popMenu();
});
uiManager.setButtonCallback("mapGo", [this](const std::string&) {
closePhoneEntirely();
if (startDialogueFunc) startDialogueFunc("dialog_taxi002");
});
}
void MenuManager::openPhoneChatFromList(std::shared_ptr<UiNode> chatRoot, const std::string& dialogueId) {
phoneChatVisibleBubbles_.clear();
uiManager.pushMenuFromSavedRoot(chatRoot);
@ -314,17 +388,19 @@ namespace ZL {
uiManager.popMenu();
}
void MenuManager::closePhoneScreenFromChat() {
void MenuManager::closePhoneEntirely() {
state = GameState::Gameplay;
phoneChatVisibleBubbles_.clear();
uiManager.popMenu();
uiManager.popMenu();
const int depth = uiManager.menuStackSize();
for (int i = 0; i < depth; ++i) uiManager.popMenu();
}
void MenuManager::closePhoneScreenFromChat() {
closePhoneEntirely();
}
void MenuManager::closePhoneScreen() {
state = GameState::Gameplay;
phoneChatVisibleBubbles_.clear();
uiManager.popMenu();
closePhoneEntirely();
}
// Registers phoneButton / journalButton callbacks on the current HUD root

View File

@ -55,6 +55,7 @@ namespace ZL {
void closePhoneScreen();
void revealPhoneChatBubble(const std::string& slotName);
bool isPhoneScreenOpen() const { return state == GameState::PhoneScreen; }
void closePhoneEntirely();
std::function<void(const std::string&)> startDialogueFunc;
std::function<void()> startDarklandsTransitionFunc;
@ -82,6 +83,11 @@ namespace ZL {
void refreshItemPickupHud();
void setupStep5Callbacks();
void setupGameplayHudCallbacks();
void openPhoneMessenger();
void openPhoneBank();
void openPhoneVideo();
void openPhoneTaxi();
void openPhoneMapScreen(std::shared_ptr<UiNode> mapRoot);
void resetPhoneChatNodes();
void recomputePhoneChatPositions();
void openPhoneChatFromList(std::shared_ptr<UiNode> chatRoot, const std::string& dialogueId);
@ -120,6 +126,11 @@ namespace ZL {
std::shared_ptr<UiNode> hudUniIntStep13Root;
std::shared_ptr<UiNode> hudUniIntDarkFullRoot;
std::shared_ptr<UiNode> hudUniExtDarkRoot;
std::shared_ptr<UiNode> phoneMainRoot;
std::shared_ptr<UiNode> phoneBankRoot;
std::shared_ptr<UiNode> phoneVideoRoot;
std::shared_ptr<UiNode> phoneMapDormRoot;
std::shared_ptr<UiNode> phoneMapUniRoot;
std::shared_ptr<UiNode> phoneChatListRoot;
std::shared_ptr<UiNode> phoneChat1Root;
std::shared_ptr<UiNode> phoneChat2Root;

View File

@ -1321,6 +1321,10 @@ namespace ZL {
menuStack.clear();
}
int UiManager::menuStackSize() const {
return static_cast<int>(menuStack.size());
}
void UiManager::draw(Renderer& renderer) {
renderer.PushProjectionMatrix(Environment::projectionWidth, Environment::projectionHeight, -1, 1);
renderer.PushMatrix();

View File

@ -407,6 +407,7 @@ namespace ZL {
bool pushMenuFromSavedRoot(std::shared_ptr<UiNode> newRoot);
bool popMenu();
void clearMenuStack();
int menuStackSize() const;
void update(float deltaMs);
void startAnimation(const std::string& animName);