From 4c58781fb6d584143647c9b08bfe1b202e5ce8a7 Mon Sep 17 00:00:00 2001 From: Yannik <80621863+vaporvee@users.noreply.github.com> Date: Tue, 11 Apr 2023 16:32:16 +0200 Subject: [PATCH] even more dialogue system improvements --- assets/lang/en/dialogue/npcs/message_one.json | 2 +- .../en/dialogue/npcs/villager_normal.json | 44 ++++++++++--------- src/scene-scripts/dialog_bubble.cs | 29 ++++++------ 3 files changed, 40 insertions(+), 35 deletions(-) diff --git a/assets/lang/en/dialogue/npcs/message_one.json b/assets/lang/en/dialogue/npcs/message_one.json index ff49a36..4942b92 100644 --- a/assets/lang/en/dialogue/npcs/message_one.json +++ b/assets/lang/en/dialogue/npcs/message_one.json @@ -1,3 +1,3 @@ { - "message": "This is a cool debug test!" + "": "This is a cool debug test!" } \ No newline at end of file diff --git a/assets/lang/en/dialogue/npcs/villager_normal.json b/assets/lang/en/dialogue/npcs/villager_normal.json index 62b42d5..04df29c 100644 --- a/assets/lang/en/dialogue/npcs/villager_normal.json +++ b/assets/lang/en/dialogue/npcs/villager_normal.json @@ -1,58 +1,60 @@ { - "dialogType": "villager", - "intro": [ + "": "villager", + "": [ [ "Hello i'm {title}. Your name must be {player}!", 0 ] ], - "welcome": [ + "": [ [ "Oh hello, {player}... You look great!", - "begindialog" + "" ], [ "Hey, {player}! Hope you have fun today!", - "begindialog" + "" ], [ "Hi! What's up {player}?", - "begindialog" + "" ] ], - "begindialog": [ + "": [ [ "What can I do for you?", { - "I just wanna talk": "tipp", - "Nevermind!": "goodbye" + "": true, + "I just wanna talk": "", + "Nevermind!": "" } ], [ "So what do you want?", { - "What's up": "tipp", - "Nothing": "goodbye" + "": true, + "What's up": "", + "Nothing": "" } ] ], - "else": [ + "": [ [ "Do you need something else?", { - "Can you tell me more?": "tipp", - "No, thanks!": "goodbye" + "Can you tell me more?": "", + "No, thanks!": "" } ], [ "So can i help you with something else?", { - "Tell me a bit more": "tipp", - "I'm good, thank you!": "goodbye" + "Tell me a bit more": "", + "I'm good, thank you!": "" } ] ], - "goodbye": [ + "": [ [ "Was nice talking to you goodbye!" ], @@ -60,20 +62,20 @@ "Have a great day, {player}!" ] ], - "tipp": [ + "": [ [ "[font s=6]░░░░░▄▄▄▄▀▀▀▀▀▀▀▀▄▄▄▄▄▄░░░░░░░░\n░░░░░█░░░░▒▒▒▒▒▒▒▒▒▒▒▒░░▀▀▄░░░░\n░░░░█░░░▒▒▒▒▒▒░░░░░░░░▒▒▒░░█░░░\n░░░█░░░░░░▄██▀▄▄░░░░░▄▄▄░░░░█░░\n░▄▀▒▄▄▄▒░█▀▀▀▀▄▄█░░░██▄▄█░░░░█░\n█░▒█▒▄░▀▄▄▄▀░░░░░░░░█░░░▒▒▒▒▒░█\n█░▒█░█▀▄▄░░░░░█▀░░░░▀▄░░▄▀▀▀▄▒█\n░█░▀▄░█▄░█▀▄▄░▀░▀▀░▄▄▀░░░░█░░█░\n░░█░░░▀▄▀█▄▄░█▀▀▀▄▄▄▄▀▀█▀██░█░░\n░░░█░░░░██░░▀█▄▄▄█▄▄█▄████░█░░░\n░░░░█░░░░▀▀▄░█░░░█░█▀██████░█░░\n░░░░░▀▄░░░░░▀▀▄▄▄█▄█▄█▄█▄▀░░█░░\n░░░░░░░▀▄▄░▒▒▒▒░░░░░░░░░░▒░░░█░\n░░░░░░░░░░▀▀▄▄░▒▒▒▒▒▒▒▒▒▒░░░░█░\n░░░░░░░░░░░░░░▀▄▄▄▄▄░░░░░░░░█░░[/font]", - "else" + "" ], [ "[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 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.", - "else" + "" ] ], - "story": [ + "": [ [ "test1test1test1test1test1test1test1test1test1test1test1test1test1test1test1", "test2test2test2test2test2test2test2test2test2test2test2test2test2test2test2", diff --git a/src/scene-scripts/dialog_bubble.cs b/src/scene-scripts/dialog_bubble.cs index 217b741..480d800 100644 --- a/src/scene-scripts/dialog_bubble.cs +++ b/src/scene-scripts/dialog_bubble.cs @@ -1,8 +1,10 @@ using Godot; +using Godot.Collections; using System.Text.RegularExpressions; public partial class dialog_bubble : CanvasLayer { + [Export] Dictionary eventBeginAnswers; Variant parsedDlg; Variant dlgLines; int dlgPointer = 0; @@ -18,7 +20,8 @@ public partial class dialog_bubble : CanvasLayer - add tree support (example: "story" key) - 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 - -answers should work more like gatherdialogue for tree support*/ + -answers should work more like gatherdialogue for tree support + - the int in ("box/rich_text_label"); @@ -37,14 +40,14 @@ public partial class dialog_bubble : CanvasLayer GetNode