Working on phone messages
This commit is contained in:
1 parent
cdab525858
commit
9425f9b19a
20 files changed
+591
-28
No files matched your search
@@ -105,6 +105,7 @@ Node DialogueDatabase::parseNode(const json& j) {
|
||||
node.falseNext = j.value("falseNext", "");
|
||||
node.cutsceneId = j.value("cutsceneId", "");
|
||||
node.luaCallback = j.value("luaCallback", "");
|
||||
node.bubbleSlot = j.value("bubbleSlot", "");
|
||||
|
||||
if (j.contains("conditions") && j["conditions"].is_array()) {
|
||||
for (const auto& item : j["conditions"]) {
|
||||
|
||||
@@ -81,6 +81,10 @@ void DialogueRuntime::setOnCutsceneFadeInComplete(std::function<void(const std::
|
||||
onCutsceneFadeInComplete = std::move(cb);
|
||||
}
|
||||
|
||||
void DialogueRuntime::setOnBubbleSlotReady(std::function<void(const std::string&)> cb) {
|
||||
onBubbleSlotReady = std::move(cb);
|
||||
}
|
||||
|
||||
void DialogueRuntime::stop() {
|
||||
activeDialogue = nullptr;
|
||||
activeCutscene = nullptr;
|
||||
@@ -431,6 +435,9 @@ void DialogueRuntime::presentLine(const Node& node) {
|
||||
if (!node.luaCallback.empty() && onDialogueLineStarted) {
|
||||
onDialogueLineStarted(node.luaCallback);
|
||||
}
|
||||
if (!node.bubbleSlot.empty() && onBubbleSlotReady) {
|
||||
onBubbleSlotReady(node.bubbleSlot);
|
||||
}
|
||||
}
|
||||
|
||||
void DialogueRuntime::presentChoices(const Node& node) {
|
||||
|
||||
@@ -22,6 +22,7 @@ public:
|
||||
void setOnDialogueLineStarted(std::function<void(const std::string&)> cb);
|
||||
void setOnCutsceneLineStarted(std::function<void(const std::string&)> cb);
|
||||
void setOnCutsceneFadeInComplete(std::function<void(const std::string&)> cb);
|
||||
void setOnBubbleSlotReady(std::function<void(const std::string&)> cb);
|
||||
void stop();
|
||||
|
||||
void update(int deltaMs);
|
||||
@@ -56,6 +57,7 @@ private:
|
||||
std::function<void(const std::string&)> onDialogueLineStarted;
|
||||
std::function<void(const std::string&)> onCutsceneLineStarted;
|
||||
std::function<void(const std::string&)> onCutsceneFadeInComplete;
|
||||
std::function<void(const std::string&)> onBubbleSlotReady;
|
||||
std::string activeCutsceneId;
|
||||
bool fadeInCallbackFired = false;
|
||||
|
||||
|
||||
@@ -140,6 +140,10 @@ void DialogueSystem::setOnCutsceneFadeInComplete(std::function<void(const std::s
|
||||
runtime.setOnCutsceneFadeInComplete(std::move(cb));
|
||||
}
|
||||
|
||||
void DialogueSystem::setOnBubbleSlotReady(std::function<void(const std::string&)> cb) {
|
||||
runtime.setOnBubbleSlotReady(std::move(cb));
|
||||
}
|
||||
|
||||
void DialogueSystem::stopDialogue() {
|
||||
runtime.stop();
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ public:
|
||||
void setOnDialogueLineStarted(std::function<void(const std::string&)> cb);
|
||||
void setOnCutsceneLineStarted(std::function<void(const std::string&)> cb);
|
||||
void setOnCutsceneFadeInComplete(std::function<void(const std::string&)> cb);
|
||||
void setOnBubbleSlotReady(std::function<void(const std::string&)> cb);
|
||||
void setOnDialogueAdvanced(std::function<void()> cb);
|
||||
void stopDialogue();
|
||||
|
||||
|
||||
@@ -96,6 +96,9 @@ struct Node {
|
||||
|
||||
// For CutsceneStart
|
||||
std::string cutsceneId;
|
||||
|
||||
// Name of the UI node (StaticImage) to reveal in the phone chat when this line is shown
|
||||
std::string bubbleSlot;
|
||||
};
|
||||
|
||||
struct DialogueDefinition {
|
||||
|
||||
Reference in new issue
Block a user