finished dialogue villager system
This commit is contained in:
@@ -4,22 +4,22 @@
|
|||||||
[
|
[
|
||||||
"Oh hello, {player}... You look great! What can I do for you?",
|
"Oh hello, {player}... You look great! What can I do for you?",
|
||||||
{
|
{
|
||||||
"I just wanna talk": true,
|
"I just wanna talk": "tipp",
|
||||||
"Nevermind!": false
|
"Nevermind!": "goodbye"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Hey, {player}! Hope you have fun today! So what do you want?",
|
"Hey, {player}! Hope you have fun today! So what do you want?",
|
||||||
{
|
{
|
||||||
"What's up": true,
|
"What's up": "tipp",
|
||||||
"Nothing": false
|
"Nothing": "goodbye"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Hi! What's up {player}?",
|
"Hi! What's up {player}?",
|
||||||
{
|
{
|
||||||
"Can we talk?": true,
|
"Can we talk?": "tipp",
|
||||||
"Have a great day!": false
|
"Have a great day!": "goodbye"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
@@ -27,24 +27,26 @@
|
|||||||
[
|
[
|
||||||
"Do you need something else?",
|
"Do you need something else?",
|
||||||
{
|
{
|
||||||
"Can you tell me something else?": true,
|
"Can you tell me something else?": "tipp",
|
||||||
"No, thanks!": false
|
"No, thanks!": "goodbye"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"So can i help you with something else?",
|
"So can i help you with something else?",
|
||||||
{
|
{
|
||||||
"Tell me a bit more maybe": true,
|
"Tell me a bit more maybe": "tipp",
|
||||||
"I'm good, thank you!": false
|
"I'm good, thank you!": "goodbye"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"goodbye": [
|
"goodbye": [
|
||||||
[
|
[
|
||||||
"Was nice talking to you goodbye!"
|
"Was nice talking to you goodbye!",
|
||||||
|
0
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Have a great day, {player}!"
|
"Have a great day, {player}!",
|
||||||
|
0
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"tipp": [
|
"tipp": [
|
||||||
|
@@ -20,6 +20,8 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
if (GetParent().Name == "player") GetParent<player>().allowMovement = false;
|
if (GetParent().Name == "player") GetParent<player>().allowMovement = false;
|
||||||
if (parsedDlg.AsGodotDictionary()["dialogType"].AsString() == "villager")
|
if (parsedDlg.AsGodotDictionary()["dialogType"].AsString() == "villager")
|
||||||
GatherDialog("welcome");
|
GatherDialog("welcome");
|
||||||
|
else if (parsedDlg.AsGodotDictionary()["dialogType"].AsString() == "message")
|
||||||
|
GatherDialog("message");
|
||||||
Visible = true;
|
Visible = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +51,10 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
{
|
{
|
||||||
if (dlgPointer < dlgLines.AsGodotArray().Count)
|
if (dlgPointer < dlgLines.AsGodotArray().Count)
|
||||||
{
|
{
|
||||||
if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.String)
|
GD.Print(dlgLines.AsGodotArray()[dlgPointer].VariantType);
|
||||||
|
if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Float && ((float)dlgLines.AsGodotArray()[dlgPointer]) == 0)
|
||||||
|
CloseDialog();
|
||||||
|
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.String)
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Dictionary)
|
else if (dlgLines.AsGodotArray()[dlgPointer].VariantType == Variant.Type.Dictionary)
|
||||||
MakeAnswerBox(Json.ParseString(dlgLines.AsGodotArray()[dlgPointer].AsGodotDictionary().Keys.ToString()).AsStringArray());
|
MakeAnswerBox(Json.ParseString(dlgLines.AsGodotArray()[dlgPointer].AsGodotDictionary().Keys.ToString()).AsStringArray());
|
||||||
@@ -61,17 +66,26 @@ public partial class dialog_bubble : CanvasLayer
|
|||||||
richText.VisibleCharacters++;
|
richText.VisibleCharacters++;
|
||||||
GetNode<Timer>("typewriter_timer").Start();
|
GetNode<Timer>("typewriter_timer").Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dlgPointer > dlgLines.AsGodotArray().Count)
|
if (dlgPointer > dlgLines.AsGodotArray().Count)
|
||||||
CloseDialog();
|
|
||||||
|
|
||||||
if (GetNode<PanelContainer>("box/panel_container").Visible == true && GetNode("box/panel_container/margin_container").GetChild(0).GetChild<Button>(0).ButtonGroup.GetPressedButton() != null)
|
|
||||||
{
|
{
|
||||||
var answer = dlgLines.AsGodotArray()[dlgPointer - 1].AsGodotDictionary()[GetNode<Button>(GetNode("box/panel_container/margin_container").GetChild(0).GetChild<Button>(0).ButtonGroup.GetPressedButton().GetPath()).Text];
|
if (parsedDlg.AsGodotDictionary()["dialogType"].AsString() == "villager")
|
||||||
GetNode<PanelContainer>("box/panel_container").Visible = false;
|
|
||||||
if (answer.VariantType == Variant.Type.Bool && answer.AsBool())
|
|
||||||
{
|
{
|
||||||
GatherDialog("tipp");
|
GatherDialog("else");
|
||||||
|
UpdateDialog();
|
||||||
|
dlgPointer++;
|
||||||
|
}
|
||||||
|
else CloseDialog();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GetNode<PanelContainer>("box/panel_container").Visible == true
|
||||||
|
&& GetNode("box/panel_container/margin_container").GetChild(0).GetChild<Button>(0).ButtonGroup.GetPressedButton() != null)
|
||||||
|
{
|
||||||
|
var answer = dlgLines.AsGodotArray()[dlgPointer - 1].AsGodotDictionary()[GetNode<Button>(GetNode("box/panel_container/margin_container")
|
||||||
|
.GetChild(0).GetChild<Button>(0).ButtonGroup.GetPressedButton().GetPath()).Text];
|
||||||
|
GetNode<PanelContainer>("box/panel_container").Visible = false;
|
||||||
|
if (answer.VariantType == Variant.Type.String)
|
||||||
|
{
|
||||||
|
GatherDialog(answer.AsString());
|
||||||
UpdateDialog();
|
UpdateDialog();
|
||||||
}
|
}
|
||||||
dlgPointer++;
|
dlgPointer++;
|
||||||
|
Reference in New Issue
Block a user