reorganized some files and deleted some for dialogue rewrite
This commit is contained in:
@@ -18,6 +18,7 @@ generate_mipmaps=false
|
||||
multichannel_signed_distance_field=false
|
||||
msdf_pixel_range=8
|
||||
msdf_size=48
|
||||
allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
|
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"dialogTitle": "Debug Character",
|
||||
"dialogType": "villager",
|
||||
"randomWelcomeText":[
|
||||
"Oh hello, {0}... You look great! What do you want from me?",
|
||||
"Hey, {0}! Hope you have fun today!",
|
||||
"Hi! What's up {0}?"
|
||||
],
|
||||
"randomGoodbyeText":[
|
||||
"Was nice talking to you goodbye!",
|
||||
"Have a great day, {0}!"
|
||||
],
|
||||
"multiTipp0":[
|
||||
"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."
|
||||
],
|
||||
"multiTipp1":[
|
||||
"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.",
|
||||
{
|
||||
"Okay I'm doing that":[
|
||||
"Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
|
||||
]
|
||||
}
|
||||
],
|
||||
"multiTipp2":[
|
||||
"test1test1test1test1test1test1test1test1test1test1test1test1test1test1test1",
|
||||
"test2test2test2test2test2test2test2test2test2test2test2test2test2test2test2",
|
||||
"test3test3test3test3test3test3test3test3test3test3test3test3test3test3test3",
|
||||
"So do you want to do xy for me?",
|
||||
{
|
||||
"Okay I'm doing that":[
|
||||
"Good nice thank you!"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
64
dialogue/npcs/villager_normal.json
Normal file
64
dialogue/npcs/villager_normal.json
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"dialogTitle": "Debug Character",
|
||||
"dialogType": "villager",
|
||||
|
||||
"player": {
|
||||
"talk" : [
|
||||
"I just wanna talk",
|
||||
"What's up",
|
||||
"Can we talk?"
|
||||
],
|
||||
"goaway" : [
|
||||
"Nevermind!",
|
||||
"Nothing",
|
||||
"Have a great day!"
|
||||
]
|
||||
},
|
||||
|
||||
"welcome":
|
||||
[
|
||||
"Oh hello, {0}... You look great! What do you want from me?",
|
||||
"Hey, {0}! Hope you have fun today! So what do you want?",
|
||||
"Hi! What's up {0}?"
|
||||
],
|
||||
"else":
|
||||
[
|
||||
"Do you need something else?",
|
||||
"So can i help you with something else?"
|
||||
],
|
||||
"goodbye":
|
||||
[
|
||||
"Was nice talking to you goodbye!",
|
||||
"Have a great day, {0}!"
|
||||
],
|
||||
|
||||
"multi":
|
||||
{
|
||||
"tipp":
|
||||
[
|
||||
[
|
||||
"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."
|
||||
],
|
||||
[
|
||||
"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."
|
||||
],
|
||||
[
|
||||
"test1test1test1test1test1test1test1test1test1test1test1test1test1test1test1",
|
||||
"test2test2test2test2test2test2test2test2test2test2test2test2test2test2test2",
|
||||
"test3test3test3test3test3test3test3test3test3test3test3test3test3test3test3",
|
||||
"So do you want to do xy for me?",
|
||||
{
|
||||
"did you detect this dictionary as answer prompt?":
|
||||
[
|
||||
"yes i have!"
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
@@ -18,7 +18,7 @@ texture = ExtResource("1_imilm")
|
||||
shape = SubResource("RectangleShape2D_pchpi")
|
||||
|
||||
[node name="dialog_trigger_area" parent="." instance=ExtResource("2_blpmd")]
|
||||
dialogFile = "res://dialog/npcs/villager_normal.json"
|
||||
dialogFile = "res://dialogue/npcs/villager_normal.json"
|
||||
|
||||
[node name="collision_shape_2d" parent="dialog_trigger_area" index="0"]
|
||||
shape = SubResource("RectangleShape2D_d78tr")
|
||||
|
@@ -7,6 +7,6 @@ public partial class dialog_trigger_area : Area2D
|
||||
string dialogFile;
|
||||
public void OnInteraction(string playerName)
|
||||
{
|
||||
GetNode("/root/main/dialog_bubble").Call("ImportString",dialogFile,playerName);
|
||||
GetNode("/root/main/dialog_bubble").Call("ImportString",dialogFile,playerName);//signal instead of call?
|
||||
}
|
||||
}
|
||||
|
@@ -1,61 +1,10 @@
|
||||
//WORK IN PROGRESS this code is very messy and will be fixed when it works
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class dialog_bubble : CanvasLayer
|
||||
{
|
||||
public Dictionary allDialog;
|
||||
public List<string> currentDialogList = new List<string>();
|
||||
public string currentKey;
|
||||
public string currentDialogLine;
|
||||
public int dialogCounter;
|
||||
public string userName;
|
||||
public void ImportString(string dialogFile, string playerName)
|
||||
{
|
||||
userName = playerName;
|
||||
GetNode("/root/main/player").Call("ChangeProcess", false);
|
||||
currentKey = "multiTipp2";//2 is a selection menu needs to be planned before coding
|
||||
using var file = FileAccess.Open(dialogFile, FileAccess.ModeFlags.Read);
|
||||
string text = file.GetAsText();
|
||||
allDialog = (Dictionary)JSON.ParseString(text);
|
||||
GetNode<Label>("NameLabel").Text = allDialog["dialogTitle"].ToString();
|
||||
addText();
|
||||
|
||||
|
||||
//Todo: Implement the better json file structure.
|
||||
|
||||
}
|
||||
public void EndDialog()
|
||||
{
|
||||
currentDialogList = new List<string>();
|
||||
dialogCounter = 0;
|
||||
Visible = false;
|
||||
GetNode("/root/main/player").Call("ChangeProcess", true);
|
||||
}
|
||||
public void addText()
|
||||
{
|
||||
var dialogWithKey = allDialog[currentKey].AsStringArray();
|
||||
if (currentKey.StartsWith("random"))
|
||||
currentDialogList.Add(dialogWithKey[GD.Randi() % dialogWithKey.Length]);
|
||||
if (currentKey.StartsWith("multi"))
|
||||
currentDialogList.AddRange(dialogWithKey);
|
||||
}
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionJustPressed("ui_accept"))
|
||||
{
|
||||
dialogCounter++;
|
||||
if (currentDialogList.Count >= dialogCounter)
|
||||
{
|
||||
Visible = true;
|
||||
currentDialogLine = currentDialogList[dialogCounter - 1];
|
||||
currentDialogLine = String.Format(currentDialogLine, userName);
|
||||
GetNode<Label>("TextLabel").Text = currentDialogLine;
|
||||
}
|
||||
if (dialogCounter > currentDialogList.Count)
|
||||
EndDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -31,8 +31,8 @@ public partial class player : CharacterBody2D
|
||||
Vector2 rayCastPosition = new Vector2((float)Math.Round(movement.x), (float)Math.Round(movement.y)) * rayCastLength;
|
||||
if (rayCastPosition.Length() != 0) rayCast.TargetPosition = rayCastPosition;
|
||||
//call event in raycasted object
|
||||
if (Input.IsActionJustPressed("ui_accept") && rayCast.IsColliding())
|
||||
rayCast.GetCollider().Call("OnInteraction", playerName);
|
||||
/*if (Input.IsActionJustPressed("ui_accept") && rayCast.IsColliding())
|
||||
rayCast.GetCollider().Call("OnInteraction", playerName);*/
|
||||
//animation system (with controller support wcih cant get normalized vector)
|
||||
if (movement.Length() != 0)
|
||||
animatedSprite.Play();
|
||||
|
Reference in New Issue
Block a user