Working on UI hints
This commit is contained in:
1 parent
3d4560bb51
commit
8552725dfc
28 files changed
+1052
-46
No files matched your search
+10
-4
@@ -215,6 +215,8 @@ namespace ZL
|
||||
"resources/navigation/uni_interior2_unlocked_hall.txt"
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
uniInteriorParams.navigationJsonPaths = {
|
||||
"resources/navigation/uni_interior0_all_locked.json",
|
||||
@@ -262,8 +264,14 @@ namespace ZL
|
||||
locations["uni_interior"]->scriptEngine.setGlobalStore(&globalInts);
|
||||
locations["uni_interior"]->scriptEngine.setGlobalFloatStore(&globalFloats);
|
||||
locations["uni_interior"]->requestDarklandsTransition = [this]() { return startDarklandsTransition(); };
|
||||
locations["uni_interior"]->requestAdvanceDarklandsHud = [this]() { menuManager.advanceUniIntDarklandsHud(); };
|
||||
if (locations["uni_interior"]->player)
|
||||
locations["uni_interior"]->player->onDeathAnimComplete = [this]() { startDarklandsTransition(); };
|
||||
for (auto& npc : locations["uni_interior"]->npcs) {
|
||||
if (npc && npc->canAttack) {
|
||||
npc->onDeathAnimComplete = [this]() { menuManager.onEnemyKilledInUniInterior(); };
|
||||
}
|
||||
}
|
||||
|
||||
LocationSetup uniExteriorParams = uniInteriorParams;
|
||||
uniExteriorParams.gameObjectsJsonPath = "resources/config2/gameobjects_uni_exterior.json";
|
||||
@@ -309,7 +317,7 @@ namespace ZL
|
||||
"resources/navigation/dorm2_b.json",
|
||||
"resources/navigation/dorm2_all_open.json",
|
||||
};*/
|
||||
|
||||
|
||||
|
||||
/*
|
||||
params_dorm.navigationJsonPaths = {
|
||||
@@ -381,6 +389,7 @@ namespace ZL
|
||||
if (menuManager.tutorialStep == TutorialStep::Step2) {
|
||||
menuManager.advanceTutorialStep();
|
||||
}
|
||||
menuManager.onPlayerStartedWalking();
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1056,7 +1065,6 @@ namespace ZL
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Only the primary, non-UI-captured pointer can promote itself into a
|
||||
// camera-rotation drag once it crosses the movement threshold.
|
||||
if (hasPrimaryPointer && fingerId == primaryPointerId && it != activePointers.end()
|
||||
@@ -1068,7 +1076,6 @@ namespace ZL
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (currentLocation) {
|
||||
// Forwarded for dialogue hover and (when cameraDragging) camera rotation.
|
||||
currentLocation->handleMotion(fingerId, eventX, eventY, mx, my);
|
||||
@@ -1108,7 +1115,6 @@ namespace ZL
|
||||
if (darklandsFlashAlpha >= 1.0f) {
|
||||
isDarklands = !isDarklands;
|
||||
|
||||
|
||||
// Change HUD
|
||||
menuManager.setDarklandsMode(isDarklands);
|
||||
|
||||
|
||||
@@ -94,6 +94,10 @@ namespace ZL
|
||||
// request the transition without coupling Location to Game directly.
|
||||
std::function<bool()> requestDarklandsTransition;
|
||||
|
||||
// Set by Game after setup(). Lua calls this to advance the uni_interior HUD
|
||||
// from step12 to step13 (trigger-zone encounter hint).
|
||||
std::function<void()> requestAdvanceDarklandsHud;
|
||||
|
||||
// Navigation editor — toggle with 'N', save with 'B', right-click to finalize polygon
|
||||
bool navigationEditorMode = false;
|
||||
|
||||
|
||||
+93
-26
@@ -81,8 +81,14 @@ 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);
|
||||
hudUniExtRoot = loadUiFromFile("resources/w/ui/hud_uni_ext.json", renderer, zipFile);
|
||||
hudUniIntRoot = loadUiFromFile("resources/w/ui/hud_uni_int.json", renderer, zipFile);
|
||||
hudUniExtRoot = loadUiFromFile("resources/w/ui/hud_uni_ext.json", renderer, zipFile);
|
||||
hudUniIntStep10Root = loadUiFromFile("resources/w/ui/hud_uni_int_step10.json", renderer, zipFile);
|
||||
hudUniIntStep11Root = loadUiFromFile("resources/w/ui/hud_uni_int_step11.json", renderer, zipFile);
|
||||
hudUniIntStep12Root = loadUiFromFile("resources/w/ui/hud_uni_int_step12.json", renderer, zipFile);
|
||||
hudUniIntStep13Root = loadUiFromFile("resources/w/ui/hud_uni_int_step13.json", renderer, zipFile);
|
||||
hudUniIntFullRoot = loadUiFromFile("resources/w/ui/hud_uni_int_full.json", renderer, zipFile);
|
||||
hudUniIntDarkFullRoot = loadUiFromFile("resources/w/ui/hud_uni_int_dark_full.json", renderer, zipFile);
|
||||
hudUniExtDarkRoot = loadUiFromFile("resources/w/ui/hud_uni_ext_dark.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);
|
||||
@@ -344,29 +350,25 @@ namespace ZL {
|
||||
}
|
||||
|
||||
void MenuManager::setupGameplayHudCallbacks() {
|
||||
uiManager.setButtonCallback("phoneButton", [this](const std::string&) {
|
||||
openPhoneScreen();
|
||||
});
|
||||
uiManager.setButtonCallback("inventoryButton", [this](const std::string&) {
|
||||
openInventory();
|
||||
});
|
||||
uiManager.setButtonCallback("journalButton", [this](const std::string&) {
|
||||
openQuestJournal();
|
||||
});
|
||||
uiManager.setButtonCallback("darklandsButton", [this](const std::string&) {
|
||||
startDarklandsTransitionFunc();
|
||||
});
|
||||
if (uiManager.findButton("phoneButton"))
|
||||
uiManager.setButtonCallback("phoneButton", [this](const std::string&) { openPhoneScreen(); });
|
||||
if (uiManager.findButton("inventoryButton"))
|
||||
uiManager.setButtonCallback("inventoryButton", [this](const std::string&) { openInventory(); });
|
||||
if (uiManager.findButton("journalButton"))
|
||||
uiManager.setButtonCallback("journalButton", [this](const std::string&) { openQuestJournal(); });
|
||||
if (uiManager.findButton("darklandsButton"))
|
||||
uiManager.setButtonCallback("darklandsButton", [this](const std::string&) { startDarklandsTransitionFunc(); });
|
||||
}
|
||||
|
||||
void MenuManager::onLocationChanged(const std::string& locationName) {
|
||||
if (state != GameState::Gameplay) return;
|
||||
currentLocationName_ = locationName;
|
||||
|
||||
if (locationName == "uni_exterior") {
|
||||
uiManager.replaceRoot(hudUniExtRoot);
|
||||
uiManager.replaceRoot(currentIsDarklands_ ? hudUniExtDarkRoot : hudUniExtRoot);
|
||||
setupGameplayHudCallbacks();
|
||||
} else if (locationName == "uni_interior") {
|
||||
uiManager.replaceRoot(hudUniIntRoot);
|
||||
setupGameplayHudCallbacks();
|
||||
applyUniIntHud();
|
||||
} else {
|
||||
// Returning to dorm: reuse step5ab, suppress already-completed hints
|
||||
uiManager.replaceRoot(hudStep5abRoot);
|
||||
@@ -408,10 +410,22 @@ namespace ZL {
|
||||
}
|
||||
|
||||
void MenuManager::onItemPickedUp(const std::string& itemId) {
|
||||
if (itemId == "note_spell" && uniIntTutorialState_ == UniIntTutorialState::Step10) {
|
||||
uniIntTutorialState_ = UniIntTutorialState::Step11;
|
||||
if (currentLocationName_ == "uni_interior" && state == GameState::Gameplay)
|
||||
applyUniIntHud();
|
||||
}
|
||||
|
||||
if (tutorialStep != TutorialStep::Step4 && tutorialStep != TutorialStep::Step5) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Dorm tutorial HUD logic must not run in other locations.
|
||||
// currentLocationName_ is empty only before the first teleport (still in dorm).
|
||||
if (!currentLocationName_.empty() && currentLocationName_ != "location_dorm") {
|
||||
return;
|
||||
}
|
||||
|
||||
if (itemId == "phone") tutorialPhonePickedUp = true;
|
||||
if (itemId == "journal") tutorialJournalPickedUp = true;
|
||||
|
||||
@@ -604,17 +618,70 @@ namespace ZL {
|
||||
|
||||
void MenuManager::setDarklandsMode(bool enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
uiManager.setNodeVisible("darklandsButton", false);
|
||||
uiManager.setNodeVisible("phoneButton", false);
|
||||
currentIsDarklands_ = enabled;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
uiManager.setNodeVisible("darklandsButton", true);
|
||||
uiManager.setNodeVisible("phoneButton", true);
|
||||
if (currentLocationName_ == "uni_interior") {
|
||||
if (enabled && uniIntTutorialState_ == UniIntTutorialState::Step11) {
|
||||
uniIntTutorialState_ = UniIntTutorialState::DarklandsActive;
|
||||
}
|
||||
applyUniIntHud();
|
||||
} else if (currentLocationName_ == "uni_exterior") {
|
||||
if (state == GameState::Gameplay) {
|
||||
uiManager.replaceRoot(enabled ? hudUniExtDarkRoot : hudUniExtRoot);
|
||||
setupGameplayHudCallbacks();
|
||||
}
|
||||
} else {
|
||||
uiManager.setNodeVisible("darklandsButton", !enabled);
|
||||
uiManager.setNodeVisible("phoneButton", !enabled);
|
||||
}
|
||||
}
|
||||
|
||||
void MenuManager::applyUniIntHud()
|
||||
{
|
||||
if (state != GameState::Gameplay) return;
|
||||
std::shared_ptr<UiNode> root;
|
||||
if (currentIsDarklands_) {
|
||||
switch (uniIntTutorialState_) {
|
||||
case UniIntTutorialState::DarklandsStep13: root = hudUniIntStep13Root; break;
|
||||
case UniIntTutorialState::DarklandsFull: root = hudUniIntDarkFullRoot; break;
|
||||
default: root = hudUniIntStep12Root; break;
|
||||
}
|
||||
} else {
|
||||
switch (uniIntTutorialState_) {
|
||||
case UniIntTutorialState::Step10: root = hudUniIntStep10Root; break;
|
||||
case UniIntTutorialState::Step11: root = hudUniIntStep11Root; break;
|
||||
default: root = hudUniIntFullRoot; break;
|
||||
}
|
||||
}
|
||||
uiManager.replaceRoot(root);
|
||||
setupGameplayHudCallbacks();
|
||||
}
|
||||
|
||||
void MenuManager::onPlayerStartedWalking()
|
||||
{
|
||||
if (currentLocationName_ == "uni_interior"
|
||||
&& currentIsDarklands_
|
||||
&& uniIntTutorialState_ == UniIntTutorialState::DarklandsActive) {
|
||||
uiManager.setNodeVisible("hint_darklands003", false);
|
||||
uiManager.setNodeVisible("hint_darklands003_arrow", false);
|
||||
}
|
||||
}
|
||||
|
||||
void MenuManager::advanceUniIntDarklandsHud()
|
||||
{
|
||||
if (uniIntTutorialState_ != UniIntTutorialState::DarklandsActive) return;
|
||||
uniIntTutorialState_ = UniIntTutorialState::DarklandsStep13;
|
||||
if (currentLocationName_ == "uni_interior" && currentIsDarklands_ && state == GameState::Gameplay)
|
||||
applyUniIntHud();
|
||||
}
|
||||
|
||||
void MenuManager::onEnemyKilledInUniInterior()
|
||||
{
|
||||
if (uniIntTutorialState_ != UniIntTutorialState::DarklandsActive
|
||||
&& uniIntTutorialState_ != UniIntTutorialState::DarklandsStep13) return;
|
||||
uniIntTutorialState_ = UniIntTutorialState::DarklandsFull;
|
||||
if (currentLocationName_ == "uni_interior" && currentIsDarklands_ && state == GameState::Gameplay)
|
||||
applyUniIntHud();
|
||||
}
|
||||
|
||||
} // namespace ZL
|
||||
+16
-1
@@ -63,6 +63,9 @@ namespace ZL {
|
||||
void advanceTutorialStep();
|
||||
void onItemPickedUp(const std::string& itemId);
|
||||
void onLocationChanged(const std::string& locationName);
|
||||
void onEnemyKilledInUniInterior();
|
||||
void advanceUniIntDarklandsHud();
|
||||
void onPlayerStartedWalking();
|
||||
|
||||
TutorialStep tutorialStep = TutorialStep::Step0;
|
||||
|
||||
@@ -81,12 +84,18 @@ namespace ZL {
|
||||
void openPhoneChatFromList(std::shared_ptr<UiNode> chatRoot, const std::string& dialogueId);
|
||||
void returnToPhoneChatList();
|
||||
void closePhoneScreenFromChat();
|
||||
void applyUniIntHud();
|
||||
|
||||
GameState state = GameState::Gameplay;
|
||||
Inventory* inventory = nullptr;
|
||||
std::string zipFile_;
|
||||
int inventorySelectedIndex_ = -1;
|
||||
|
||||
enum class UniIntTutorialState { Step10, Step11, DarklandsActive, DarklandsStep13, DarklandsFull };
|
||||
UniIntTutorialState uniIntTutorialState_ = UniIntTutorialState::Step10;
|
||||
std::string currentLocationName_;
|
||||
bool currentIsDarklands_ = false;
|
||||
|
||||
bool tutorialPhonePickedUp = false;
|
||||
bool tutorialJournalPickedUp = false;
|
||||
bool tutorialPhoneScreenOpened = false;
|
||||
@@ -101,7 +110,13 @@ namespace ZL {
|
||||
std::shared_ptr<UiNode> hudStep5bRoot;
|
||||
std::shared_ptr<UiNode> hudStep5abRoot;
|
||||
std::shared_ptr<UiNode> hudUniExtRoot;
|
||||
std::shared_ptr<UiNode> hudUniIntRoot;
|
||||
std::shared_ptr<UiNode> hudUniIntStep10Root;
|
||||
std::shared_ptr<UiNode> hudUniIntStep11Root;
|
||||
std::shared_ptr<UiNode> hudUniIntStep12Root;
|
||||
std::shared_ptr<UiNode> hudUniIntFullRoot;
|
||||
std::shared_ptr<UiNode> hudUniIntStep13Root;
|
||||
std::shared_ptr<UiNode> hudUniIntDarkFullRoot;
|
||||
std::shared_ptr<UiNode> hudUniExtDarkRoot;
|
||||
std::shared_ptr<UiNode> phoneChatListRoot;
|
||||
std::shared_ptr<UiNode> phoneChat1Root;
|
||||
std::shared_ptr<UiNode> phoneChat2Root;
|
||||
|
||||
@@ -203,6 +203,15 @@ namespace ZL {
|
||||
game->requestDarklandsTransition();
|
||||
});
|
||||
|
||||
// advance_darklands_hud()
|
||||
// Advances the uni_interior darklands HUD from step12 to step13.
|
||||
// Call when the player enters the ghost trigger zone in darklands.
|
||||
api.set_function("advance_darklands_hud",
|
||||
[game]() {
|
||||
if (game->requestAdvanceDarklandsHud)
|
||||
game->requestAdvanceDarklandsHud();
|
||||
});
|
||||
|
||||
// set_location_callbacks(on_enter, on_exit)
|
||||
// on_enter() called once when the player arrives at this location.
|
||||
// on_exit() called once just before the player leaves this location.
|
||||
|
||||
Reference in new issue
Block a user