minor changes and added rewritten version of dialog json will be implemented later

This commit is contained in:
2022-12-17 22:50:23 +01:00
parent 9616c1f0d1
commit 6a52d487c7
3 changed files with 57 additions and 11 deletions

View File

@@ -0,0 +1,51 @@
{
"dialogTitle": "Debug Character",
"dialogType": "villager",
"random":
{
"welcome":
[
"Oh hello, {0}... You look great! What do you want from me?",
"Hey, {0}! Hope you have fun today!",
"Hi! What's up {0}?"
],
"goodbye":
[
"Was nice talking to you goodbye!",
"Have a great day, {0}!"
]
},
"multi":
{
"tipp":
{
"0":
[
"You can walk arround with WASD on PC.",
"You can also use your joystick and D-Pad, if you have a controller.",
"You can interact with cupcakes and use the buggy placeholder clouds as a football."
],
"1":
[
"Lorem ipsum dolor sit amet, consetetur sadipscing elitr,",
"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."
],
"2":
[
"test1test1test1test1test1test1test1test1test1test1test1test1test1test1test1",
"test2test2test2test2test2test2test2test2test2test2test2test2test2test2test2",
"test3test3test3test3test3test3test3test3test3test3test3test3test3test3test3",
"So do you want to do xy for me?",
{
"Okay I'm doing that":
[
"Good nice thank you!"
]
}
]
}
}
}

View File

@@ -26,7 +26,7 @@
] ]
} }
], ],
"multiDebugTipp2":[ "multiTipp2":[
"test1test1test1test1test1test1test1test1test1test1test1test1test1test1test1", "test1test1test1test1test1test1test1test1test1test1test1test1test1test1test1",
"test2test2test2test2test2test2test2test2test2test2test2test2test2test2test2", "test2test2test2test2test2test2test2test2test2test2test2test2test2test2test2",
"test3test3test3test3test3test3test3test3test3test3test3test3test3test3test3", "test3test3test3test3test3test3test3test3test3test3test3test3test3test3test3",

View File

@@ -16,7 +16,7 @@ public partial class dialog_bubble : CanvasLayer
{ {
userName = playerName; userName = playerName;
GetNode("/root/main/player").Call("ChangeProcess", false); GetNode("/root/main/player").Call("ChangeProcess", false);
currentKey = "multiTipp0";//2 is a selection menu needs to be planned before coding currentKey = "multiTipp2";//2 is a selection menu needs to be planned before coding
using var file = FileAccess.Open(dialogFile, FileAccess.ModeFlags.Read); using var file = FileAccess.Open(dialogFile, FileAccess.ModeFlags.Read);
string text = file.GetAsText(); string text = file.GetAsText();
allDialog = (Dictionary)JSON.ParseString(text); allDialog = (Dictionary)JSON.ParseString(text);
@@ -24,7 +24,7 @@ public partial class dialog_bubble : CanvasLayer
addText(); addText();
//Todo: add multiline text and actual running dialog. And go through string for other dictionaries wich always will be playeranswers //Todo: Implement the better json file structure.
} }
public void EndDialog() public void EndDialog()
@@ -36,16 +36,11 @@ public partial class dialog_bubble : CanvasLayer
} }
public void addText() public void addText()
{ {
var dialogWithKey = allDialog[currentKey].AsStringArray();
if (currentKey.StartsWith("random")) if (currentKey.StartsWith("random"))
{ currentDialogList.Add(dialogWithKey[GD.Randi() % dialogWithKey.Length]);
string[] dialogRand = allDialog[currentKey].AsStringArray();
currentDialogList.Add(dialogRand[GD.Randi() % dialogRand.Length]);
}
if (currentKey.StartsWith("multi")) if (currentKey.StartsWith("multi"))
{ currentDialogList.AddRange(dialogWithKey);
string[] dialogMulti = allDialog[currentKey].AsStringArray();
currentDialogList.AddRange(dialogMulti);
}
} }
public override void _Process(double delta) public override void _Process(double delta)
{ {