Working on night mode and how player goes in
This commit is contained in:
1 parent
1d3bea452c
commit
9221ab68ac
8 files changed
+550
-274
No files matched your search
+5
-2
@@ -15,7 +15,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifdef EMSCRIPTEN
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
@@ -1191,7 +1190,11 @@ namespace ZL
|
||||
if (darklandsFlashAlpha >= 1.0f) {
|
||||
if (isNightTransition) {
|
||||
menuManager.isNight = !menuManager.isNight;
|
||||
if (currentLocation) currentLocation->dialogueSystem.startDialogue("dialog_video001");
|
||||
if (currentLocation)
|
||||
{
|
||||
//currentLocation->dialogueSystem.startDialogue("dialog_video001");
|
||||
currentLocation->scriptEngine.callTriggerNightEnterCallback();
|
||||
}
|
||||
} else {
|
||||
isDarklands = !isDarklands;
|
||||
|
||||
|
||||
@@ -362,6 +362,7 @@ namespace ZL {
|
||||
money_ -= amount;
|
||||
}
|
||||
|
||||
|
||||
void MenuManager::openPhoneBank() {
|
||||
uiManager.pushMenuFromSavedRoot(phoneBankRoot);
|
||||
uiManager.setText("balanceText", formatMoney(money_));
|
||||
|
||||
@@ -25,6 +25,7 @@ namespace ZL {
|
||||
sol::protected_function locationExitCallback;
|
||||
sol::protected_function darklandsEnterCallback;
|
||||
sol::protected_function darklandsExitCallback;
|
||||
sol::protected_function triggerNightEnterCallback;
|
||||
};
|
||||
|
||||
ScriptEngine::ScriptEngine() = default;
|
||||
@@ -318,6 +319,12 @@ namespace ZL {
|
||||
this_impl->darklandsExitCallback = onExit.as<sol::protected_function>();
|
||||
});
|
||||
|
||||
api.set_function("set_enter_night_callback",
|
||||
[this_impl = impl.get()](sol::object onEnter) {
|
||||
if (onEnter.is<sol::protected_function>())
|
||||
this_impl->triggerNightEnterCallback = onEnter.as<sol::protected_function>();
|
||||
});
|
||||
|
||||
api.set_function("set_trigger_zone_enabled",
|
||||
[game](int index, bool value) {
|
||||
auto& triggerZones = game->triggerZones;
|
||||
@@ -742,6 +749,15 @@ namespace ZL {
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEngine::callTriggerNightEnterCallback() {
|
||||
if (!impl || !impl->triggerNightEnterCallback.valid()) return;
|
||||
auto result = impl->triggerNightEnterCallback();
|
||||
if (!result.valid()) {
|
||||
sol::error err = result;
|
||||
std::cerr << "[SCRIPT] trigger night enter callback error: " << err.what() << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
void ScriptEngine::callDarklandsExitCallback() {
|
||||
if (!impl || !impl->darklandsExitCallback.valid()) return;
|
||||
auto result = impl->darklandsExitCallback();
|
||||
|
||||
@@ -44,6 +44,8 @@ public:
|
||||
void callDarklandsEnterCallback();
|
||||
void callDarklandsExitCallback();
|
||||
|
||||
void callTriggerNightEnterCallback();
|
||||
|
||||
void callCutsceneCompleteCallback(const std::string& cutsceneId);
|
||||
|
||||
private:
|
||||
|
||||
Reference in new issue
Block a user