even more dialogue system improvements
This commit is contained in:
@@ -1,3 +1,3 @@
|
|||||||
{
|
{
|
||||||
"message": "This is a cool debug test!"
|
"<message>": "This is a cool debug test!"
|
||||||
}
|
}
|
@@ -1,58 +1,60 @@
|
|||||||
{
|
{
|
||||||
"dialogType": "villager",
|
"<dialogType>": "villager",
|
||||||
"intro": [
|
"<intro>": [
|
||||||
[
|
[
|
||||||
"Hello i'm {title}. Your name must be {player}!",
|
"Hello i'm {title}. Your name must be {player}!",
|
||||||
0
|
0
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"welcome": [
|
"<welcome>": [
|
||||||
[
|
[
|
||||||
"Oh hello, {player}... You look great!",
|
"Oh hello, {player}... You look great!",
|
||||||
"<goto:>begindialog"
|
"<goto:0:begindialog>"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Hey, {player}! Hope you have fun today!",
|
"Hey, {player}! Hope you have fun today!",
|
||||||
"<goto:>begindialog"
|
"<goto:0:begindialog>"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Hi! What's up {player}?",
|
"Hi! What's up {player}?",
|
||||||
"<goto:>begindialog"
|
"<goto:0:begindialog>"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"begindialog": [
|
"<begindialog>": [
|
||||||
[
|
[
|
||||||
"What can I do for you?",
|
"What can I do for you?",
|
||||||
{
|
{
|
||||||
"I just wanna talk": "<goto:>tipp",
|
"<eventBeginAnswers>": true,
|
||||||
"Nevermind!": "<goto:>goodbye"
|
"I just wanna talk": "<goto:0:tipp>",
|
||||||
|
"Nevermind!": "<goto:0:goodbye>"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"So what do you want?",
|
"So what do you want?",
|
||||||
{
|
{
|
||||||
"What's up": "<goto:>tipp",
|
"<eventBeginAnswers>": true,
|
||||||
"Nothing": "<goto:>goodbye"
|
"What's up": "<goto:0:tipp>",
|
||||||
|
"Nothing": "<goto:0:goodbye>"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"else": [
|
"<else>": [
|
||||||
[
|
[
|
||||||
"Do you need something else?",
|
"Do you need something else?",
|
||||||
{
|
{
|
||||||
"Can you tell me more?": "<goto:>tipp",
|
"Can you tell me more?": "<goto:0:tipp>",
|
||||||
"No, thanks!": "<goto:>goodbye"
|
"No, thanks!": "<goto:0:goodbye>"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"So can i help you with something else?",
|
"So can i help you with something else?",
|
||||||
{
|
{
|
||||||
"Tell me a bit more": "<goto:>tipp",
|
"Tell me a bit more": "<goto:0:tipp>",
|
||||||
"I'm good, thank you!": "<goto:>goodbye"
|
"I'm good, thank you!": "<goto:0:goodbye>"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"goodbye": [
|
"<goodbye>": [
|
||||||
[
|
[
|
||||||
"Was nice talking to you goodbye!"
|
"Was nice talking to you goodbye!"
|
||||||
],
|
],
|
||||||
@@ -60,20 +62,20 @@
|
|||||||
"Have a great day, {player}!"
|
"Have a great day, {player}!"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"tipp": [
|
"<tipp>": [
|
||||||
[
|
[
|
||||||
"[font s=6]░░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░░\n░░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄░░░░\n░░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█░░░\n░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░░█░░\n░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░░█░\n█░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒░█\n█░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█\n░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█░\n░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█░░\n░░░█░░░░██░░▀█▄▄▄█▄▄█▄████░█░░░\n░░░░█░░░░▀▀▄░█░░░█░█▀██████░█░░\n░░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█░░\n░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░▒░░░█░\n░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░░░░█░\n░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░░░░█░░[/font]",
|
"[font s=6]░░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░░\n░░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄░░░░\n░░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█░░░\n░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░░█░░\n░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░░█░\n█░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒░█\n█░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█\n░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█░\n░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█░░\n░░░█░░░░██░░▀█▄▄▄█▄▄█▄████░█░░░\n░░░░█░░░░▀▀▄░█░░░█░█▀██████░█░░\n░░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█░░\n░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░▒░░░█░\n░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░░░░█░\n░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░░░░█░░[/font]",
|
||||||
"<goto:>else"
|
"<goto:0:else>"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"[center][font s=80][wave amp=50 freq=15][rainbow]This is cool test text[/rainbow][/wave][/font][/center]",
|
"[center][font s=80][wave amp=50 freq=15][rainbow]This is cool test text[/rainbow][/wave][/font][/center]",
|
||||||
"sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,",
|
"sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat,",
|
||||||
"sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.",
|
"sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum.",
|
||||||
"Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
|
"Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
|
||||||
"<goto:>else"
|
"<goto:0:else>"
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"story": [
|
"<story>": [
|
||||||
[
|
[
|
||||||
"test1test1test1test1test1test1test1test1test1test1test1test1test1test1test1",
|
"test1test1test1test1test1test1test1test1test1test1test1test1test1test1test1",
|
||||||
"test2test2test2test2test2test2test2test2test2test2test2test2test2test2test2",
|
"test2test2test2test2test2test2test2test2test2test2test2test2test2test2test2",
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
using Godot;
|
using Godot;
|
||||||
|
using Godot.Collections;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
|
||||||
public partial class dialog_bubble : CanvasLayer
|
public partial class dialog_bubble : CanvasLayer
|
||||||
{
|
{
|
||||||
|
[Export] Dictionary eventBeginAnswers;
|
||||||
Variant parsedDlg;
|
Variant parsedDlg;
|
||||||
Variant dlgLines;
|
Variant dlgLines;
|
||||||
int dlgPointer = 0;
|
int dlgPointer = 0;
|
||||||
@@ -18,7 +20,8 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
- add tree support (example: "story" key)
|
- add tree support (example: "story" key)
|
||||||
- ability to add dialogue begin answers on the fly (special ones are colored)
|
- ability to add dialogue begin answers on the fly (special ones are colored)
|
||||||
they will be in a dictionary with event IDs or Dictionary keys it also needs an array wich ones are active
|
they will be in a dictionary with event IDs or Dictionary keys it also needs an array wich ones are active
|
||||||
-answers should work more like gatherdialogue for tree support*/
|
-answers should work more like gatherdialogue for tree support
|
||||||
|
- the int in <goto:0 <- should represent the parsedDlgPointer*/
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
richText = GetNode<RichTextLabel>("box/rich_text_label");
|
richText = GetNode<RichTextLabel>("box/rich_text_label");
|
||||||
@@ -37,14 +40,14 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
GetNode<Label>("box/name_label").Text = title;
|
GetNode<Label>("box/name_label").Text = title;
|
||||||
player.allowMovement = false;
|
player.allowMovement = false;
|
||||||
//Get first key
|
//Get first key
|
||||||
if (introducedVillager && parsedDlg.AsGodotDictionary().ContainsKey("welcome"))
|
if (introducedVillager && parsedDlg.AsGodotDictionary().ContainsKey("<welcome>"))
|
||||||
GatherDialog("welcome");
|
GatherDialog("<welcome>");
|
||||||
else if (parsedDlg.AsGodotDictionary().ContainsKey("intro"))
|
else if (parsedDlg.AsGodotDictionary().ContainsKey("<intro>"))
|
||||||
GatherDialog("intro");
|
GatherDialog("<intro>");
|
||||||
else if (parsedDlg.AsGodotDictionary().ContainsKey("message"))
|
else if (parsedDlg.AsGodotDictionary().ContainsKey("<message>"))
|
||||||
{
|
{
|
||||||
GetNode<Label>("box/name_label").Text = title;
|
GetNode<Label>("box/name_label").Text = title;
|
||||||
GatherDialog("message");
|
GatherDialog("<message>");
|
||||||
}
|
}
|
||||||
|
|
||||||
Visible = true;
|
Visible = true;
|
||||||
@@ -97,11 +100,11 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
//read and write the dialogue
|
//read and write the dialogue
|
||||||
if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Float)
|
if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Float)
|
||||||
InDialogEvents((int)dlgLines.AsGodotArray()[dlgPointer]);
|
InDialogEvents((int)dlgLines.AsGodotArray()[dlgPointer]);
|
||||||
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.String && !dlgLines.AsGodotArray()[dlgPointer].AsString().StartsWith("<goto:>"))
|
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.String && !dlgLines.AsGodotArray()[dlgPointer].AsString().StartsWith("<goto:"))
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.String && dlgLines.AsGodotArray()[dlgPointer].AsString().StartsWith("<goto:>"))
|
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.String && dlgLines.AsGodotArray()[dlgPointer].AsString().StartsWith("<goto:"))
|
||||||
{
|
{
|
||||||
GatherDialog(dlgLines.AsGodotArray()[dlgPointer].AsString().Replace("<goto:>", ""));
|
GatherDialog(dlgLines.AsGodotArray()[dlgPointer].AsString().Replace("goto:0:", ""));
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
}
|
}
|
||||||
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Dictionary)
|
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Dictionary)
|
||||||
@@ -150,9 +153,9 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
var answer = dlgLines.AsGodotArray()[dlgPointer - 1].AsGodotDictionary()[GetNode<Button>(GetNode("box/panel_container/margin_container")
|
var answer = dlgLines.AsGodotArray()[dlgPointer - 1].AsGodotDictionary()[GetNode<Button>(GetNode("box/panel_container/margin_container")
|
||||||
.GetChild(0).GetChild<Button>(0).ButtonGroup.GetPressedButton().GetPath()).Text];
|
.GetChild(0).GetChild<Button>(0).ButtonGroup.GetPressedButton().GetPath()).Text];
|
||||||
GetNode<PanelContainer>("box/panel_container").Visible = false;
|
GetNode<PanelContainer>("box/panel_container").Visible = false;
|
||||||
if (answer.VariantType == Variant.Type.String && answer.AsString().StartsWith("<goto:>"))
|
if (answer.VariantType == Variant.Type.String && answer.AsString().StartsWith("<goto:"))
|
||||||
{
|
{
|
||||||
GatherDialog(answer.AsString().Replace("<goto:>", ""));
|
GatherDialog(answer.AsString().Replace("goto:0:", ""));
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
}
|
}
|
||||||
dlgPointer++;
|
dlgPointer++;
|
||||||
@@ -165,7 +168,7 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
case 0:
|
case 0:
|
||||||
GetNode<Label>("box/name_label").Text = title;
|
GetNode<Label>("box/name_label").Text = title;
|
||||||
triggerArea.Set("introducedVillager", true);
|
triggerArea.Set("introducedVillager", true);
|
||||||
GatherDialog("begindialog");
|
GatherDialog("<begindialog>");
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user