Working on phone and bank account

This commit is contained in:
Vladislav Khorev committed 2026-06-03 22:53:47 +03:00
1 parent 1b1ceac2fe
commit e6bfe85e2e
6 files changed
+98 -1

No files matched your search

+35
View File
@@ -53,6 +53,19 @@ namespace ZL {
return max(1, lines);
}
static std::string formatMoney(int amount) {
bool negative = amount < 0;
std::string digits = std::to_string(negative ? -amount : amount);
std::string result;
const int len = static_cast<int>(digits.size());
for (int i = 0; i < len; ++i) {
if (i > 0 && (len - i) % 3 == 0) result += ' ';
result += digits[i];
}
if (negative) result = "-" + result;
return result + " сом";
}
static std::array<float, 4> questStatusColor(Quest::QuestStatus status) {
switch (status) {
case Quest::QuestStatus::Completed: return { 0.25f, 0.95f, 0.35f, 1.0f };
@@ -292,24 +305,44 @@ namespace ZL {
void MenuManager::openPhoneMessenger() {
uiManager.pushMenuFromSavedRoot(phoneChatListRoot);
refreshChatUnreadIndicators();
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
});
uiManager.setButtonCallback("phoneMain", [this](const std::string&) {});
uiManager.setTextButtonCallback("chat1button", [this](const std::string&) {
chatUnread_[0] = false;
openPhoneChatFromList(phoneChat1Root, "dialog_chat_aiperi001");
});
uiManager.setTextButtonCallback("chat2button", [this](const std::string&) {
chatUnread_[1] = false;
openPhoneChatFromList(phoneChat2Root, "dialog_chat_parents001");
});
uiManager.setTextButtonCallback("chat3button", [this](const std::string&) {
chatUnread_[2] = false;
openPhoneChatFromList(phoneChat3Root, "dialog_chat_news001");
});
}
void MenuManager::refreshChatUnreadIndicators() {
uiManager.setNodeVisible("chat1Unread", chatUnread_[0]);
uiManager.setNodeVisible("chat2Unread", chatUnread_[1]);
uiManager.setNodeVisible("chat3Unread", chatUnread_[2]);
}
void MenuManager::setChatUnread(int chatIndex, bool unread) {
if (chatIndex < 0 || chatIndex > 2) return;
chatUnread_[chatIndex] = unread;
}
void MenuManager::spendMoney(int amount) {
money_ -= amount;
}
void MenuManager::openPhoneBank() {
uiManager.pushMenuFromSavedRoot(phoneBankRoot);
uiManager.setText("balanceText", formatMoney(money_));
uiManager.setButtonCallback("phoneExitButton", [this](const std::string&) {
closePhoneEntirely();
@@ -355,6 +388,7 @@ namespace ZL {
uiManager.popMenu();
});
uiManager.setButtonCallback("mapGo", [this](const std::string&) {
money_ -= 500;
closePhoneEntirely();
if (startDialogueFunc) startDialogueFunc("dialog_taxi002");
});
@@ -386,6 +420,7 @@ namespace ZL {
void MenuManager::returnToPhoneChatList() {
phoneChatVisibleBubbles_.clear();
uiManager.popMenu();
refreshChatUnreadIndicators();
}
void MenuManager::closePhoneEntirely() {