json dialog implementation progression
This commit is contained in:
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"cupcake":[
|
||||
"this is a test string...",
|
||||
"It looks delicious!",
|
||||
"Eat it when its an finished item!"
|
||||
]
|
||||
}
|
26
dialog/npcs/villagers.json
Normal file
26
dialog/npcs/villagers.json
Normal file
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"1": {
|
||||
"randomWelcomeText":[
|
||||
"Oh hello, §player§... You look great! What do you want from me?",
|
||||
"Hey, §player§! Hope you have fun today!",
|
||||
"Hi! What's up §player§?"
|
||||
],
|
||||
"debugAnswer": "Cool master you set me up successfully for this simulation!",
|
||||
"randomGoodbyeText":[
|
||||
"Was nice talking to you goodbye!",
|
||||
"Have a great day, §player§!"
|
||||
]
|
||||
},
|
||||
"2": {
|
||||
"randomWelcomeText":[
|
||||
"Oh hello, §player§... You look great! What do you want from me?",
|
||||
"Hey, §player§! Hope you have fun today!",
|
||||
"Hi! What's up §player§?"
|
||||
],
|
||||
"debugAnswer": "Cool master you set me up successfully for this simulation!",
|
||||
"randomGoodbyeText":[
|
||||
"Was nice talking to you goodbye!",
|
||||
"Have a great day, §player§!"
|
||||
]
|
||||
}
|
||||
}
|
@@ -1,10 +1,14 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://h8na2j1qthm4"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://h8na2j1qthm4"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://p5ubildre2tg" path="res://assets/textures/debug/cupcake.png" id="1_imilm"]
|
||||
[ext_resource type="PackedScene" uid="uid://hkcebwbua6wm" path="res://scenes/gui/dialog_trigger_area.tscn" id="2_blpmd"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_pchpi"]
|
||||
size = Vector2(64, 58.5)
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_d78tr"]
|
||||
size = Vector2(64, 58)
|
||||
|
||||
[node name="dialogdebug_cupcake" type="StaticBody2D"]
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
@@ -12,3 +16,11 @@ texture = ExtResource("1_imilm")
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("RectangleShape2D_pchpi")
|
||||
|
||||
[node name="dialog_trigger_area" parent="." instance=ExtResource("2_blpmd")]
|
||||
dialogFile = "res://dialog/npcs/villagers.json"
|
||||
|
||||
[node name="collision_shape_2d" parent="dialog_trigger_area" index="0"]
|
||||
shape = SubResource("RectangleShape2D_d78tr")
|
||||
|
||||
[editable path="dialog_trigger_area"]
|
||||
|
@@ -1,13 +1,14 @@
|
||||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class dialog_trigger_area : Area2D
|
||||
{
|
||||
[Export(PropertyHint.File, "*json")]
|
||||
string dialogFile;
|
||||
public override void _Ready()
|
||||
{
|
||||
|
||||
using var file = FileAccess.Open(dialogFile, FileAccess.ModeFlags.Read);
|
||||
string text = file.GetAsText();
|
||||
GD.Print(text);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user