mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Created a new database for the Dialog System. Will test and see if there is a case for Joins next week.
This commit is contained in:
parent
4cc0d0a8ff
commit
13912aad7e
@ -0,0 +1,170 @@
|
||||
[editor_states]
|
||||
|
||||
Anim={
|
||||
"visible": false
|
||||
}
|
||||
2D={
|
||||
"grid_offset": Vector2(0, 0),
|
||||
"grid_snap_active": false,
|
||||
"grid_step": Vector2(8, 8),
|
||||
"grid_visibility": 1,
|
||||
"ofs": Vector2(-165, -110),
|
||||
"primary_grid_steps": 8,
|
||||
"show_edit_locks": true,
|
||||
"show_guides": true,
|
||||
"show_helpers": false,
|
||||
"show_origin": true,
|
||||
"show_rulers": true,
|
||||
"show_transformation_gizmos": true,
|
||||
"show_viewport": true,
|
||||
"show_zoom_control": true,
|
||||
"smart_snap_active": false,
|
||||
"snap_guides": true,
|
||||
"snap_node_anchors": true,
|
||||
"snap_node_center": true,
|
||||
"snap_node_parent": true,
|
||||
"snap_node_sides": true,
|
||||
"snap_other_nodes": true,
|
||||
"snap_pixel": true,
|
||||
"snap_relative": false,
|
||||
"snap_rotation": false,
|
||||
"snap_rotation_offset": 0.0,
|
||||
"snap_rotation_step": 0.261799,
|
||||
"snap_scale": false,
|
||||
"snap_scale_step": 0.1,
|
||||
"zoom": 1.0
|
||||
}
|
||||
3D={
|
||||
"fov": 70.01,
|
||||
"gizmos_status": {
|
||||
"AudioListener3D": 0,
|
||||
"AudioStreamPlayer3D": 0,
|
||||
"CPUParticles3D": 0,
|
||||
"CSGShape3D": 0,
|
||||
"Camera3D": 0,
|
||||
"CollisionObject3D": 0,
|
||||
"CollisionPolygon3D": 0,
|
||||
"CollisionShape3D": 0,
|
||||
"Decal": 0,
|
||||
"FogVolume": 0,
|
||||
"GPUParticles3D": 0,
|
||||
"GPUParticlesCollision3D": 0,
|
||||
"Joint3D": 0,
|
||||
"Light3D": 0,
|
||||
"LightmapGI": 0,
|
||||
"LightmapProbe": 0,
|
||||
"Marker3D": 0,
|
||||
"NavigationLink3D": 0,
|
||||
"NavigationRegion3D": 0,
|
||||
"OccluderInstance3D": 0,
|
||||
"Path3D": 0,
|
||||
"PhysicalBone3D": 0,
|
||||
"RayCast3D": 0,
|
||||
"ReflectionProbe": 0,
|
||||
"ShapeCast3D": 0,
|
||||
"Skeleton3D": 0,
|
||||
"SoftBody3D": 0,
|
||||
"SpringArm3D": 0,
|
||||
"VehicleWheel3D": 0,
|
||||
"VisibleOnScreenNotifier3D": 0,
|
||||
"VoxelGI": 0
|
||||
},
|
||||
"local_coords": false,
|
||||
"preview_sun_env": {
|
||||
"environ_ao_enabled": false,
|
||||
"environ_enabled": true,
|
||||
"environ_energy": 1.0,
|
||||
"environ_gi_enabled": false,
|
||||
"environ_glow_enabled": true,
|
||||
"environ_ground_color": Color(0.2, 0.169, 0.133, 1),
|
||||
"environ_sky_color": Color(0.385, 0.454, 0.55, 1),
|
||||
"environ_tonemap_enabled": true,
|
||||
"sun_color": Color(1, 1, 1, 1),
|
||||
"sun_enabled": true,
|
||||
"sun_energy": 1.0,
|
||||
"sun_max_distance": 100.0,
|
||||
"sun_rotation": Vector2(-1.0472, 2.61799)
|
||||
},
|
||||
"rotate_snap": 15.0,
|
||||
"scale_snap": 10.0,
|
||||
"show_grid": true,
|
||||
"show_origin": true,
|
||||
"snap_enabled": false,
|
||||
"translate_snap": 1.0,
|
||||
"viewport_mode": 1,
|
||||
"viewports": [{
|
||||
"auto_orthogonal": false,
|
||||
"auto_orthogonal_enabled": true,
|
||||
"cinematic_preview": false,
|
||||
"display_mode": 20,
|
||||
"distance": 4.0,
|
||||
"doppler": false,
|
||||
"frame_time": false,
|
||||
"gizmos": true,
|
||||
"half_res": false,
|
||||
"information": false,
|
||||
"listener": true,
|
||||
"position": Vector3(0, 0, 0),
|
||||
"use_environment": false,
|
||||
"use_orthogonal": false,
|
||||
"view_type": 0,
|
||||
"x_rotation": 0.5,
|
||||
"y_rotation": -0.5
|
||||
}, {
|
||||
"auto_orthogonal": false,
|
||||
"auto_orthogonal_enabled": true,
|
||||
"cinematic_preview": false,
|
||||
"display_mode": 20,
|
||||
"distance": 4.0,
|
||||
"doppler": false,
|
||||
"frame_time": false,
|
||||
"gizmos": true,
|
||||
"half_res": false,
|
||||
"information": false,
|
||||
"listener": false,
|
||||
"position": Vector3(0, 0, 0),
|
||||
"use_environment": false,
|
||||
"use_orthogonal": false,
|
||||
"view_type": 0,
|
||||
"x_rotation": 0.5,
|
||||
"y_rotation": -0.5
|
||||
}, {
|
||||
"auto_orthogonal": false,
|
||||
"auto_orthogonal_enabled": true,
|
||||
"cinematic_preview": false,
|
||||
"display_mode": 20,
|
||||
"distance": 4.0,
|
||||
"doppler": false,
|
||||
"frame_time": false,
|
||||
"gizmos": true,
|
||||
"half_res": false,
|
||||
"information": false,
|
||||
"listener": false,
|
||||
"position": Vector3(0, 0, 0),
|
||||
"use_environment": false,
|
||||
"use_orthogonal": false,
|
||||
"view_type": 0,
|
||||
"x_rotation": 0.5,
|
||||
"y_rotation": -0.5
|
||||
}, {
|
||||
"auto_orthogonal": false,
|
||||
"auto_orthogonal_enabled": true,
|
||||
"cinematic_preview": false,
|
||||
"display_mode": 20,
|
||||
"distance": 4.0,
|
||||
"doppler": false,
|
||||
"frame_time": false,
|
||||
"gizmos": true,
|
||||
"half_res": false,
|
||||
"information": false,
|
||||
"listener": false,
|
||||
"position": Vector3(0, 0, 0),
|
||||
"use_environment": false,
|
||||
"use_orthogonal": false,
|
||||
"view_type": 0,
|
||||
"x_rotation": 0.5,
|
||||
"y_rotation": -0.5
|
||||
}],
|
||||
"zfar": 4000.01,
|
||||
"znear": 0.05
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
[folding]
|
||||
|
||||
node_unfolds=[]
|
||||
resource_unfolds=[]
|
||||
nodes_folded=[]
|
@ -0,0 +1,3 @@
|
||||
[folding]
|
||||
|
||||
sections_unfolded=PackedStringArray()
|
@ -16,11 +16,11 @@ dock_5="Inspector,Node,History"
|
||||
|
||||
[EditorNode]
|
||||
|
||||
open_scenes=["res://screens/MainMenu.tscn", "res://GenresSubstitution/TestDB.tscn"]
|
||||
open_scenes=["res://screens/MainMenu.tscn", "res://GenresSubstitution/TestDB.tscn", "res://Dialog/TestDialog.tscn"]
|
||||
|
||||
[ScriptEditor]
|
||||
|
||||
open_scripts=["res://GenresSubstitution/genre_sub.gd"]
|
||||
open_scripts=["res://GenresSubstitution/genre_sub.gd", "res://Dialog/dialog_system.gd"]
|
||||
open_help=[]
|
||||
script_split_offset=150
|
||||
list_split_offset=0
|
||||
|
@ -1,5 +1,5 @@
|
||||
2a60927148abd1d33b818b535e306557
|
||||
::res://::1682270223
|
||||
::res://::1682875387
|
||||
default_env.tres::Environment::-1::1680461469::0::1::::<><>::
|
||||
icon.png::CompressedTexture2D::1663579034843721578::1659896126::1681665020::1::::<><>::
|
||||
README.txt::TextFile::-1::1679251181::0::1::::<><>::
|
||||
@ -37,11 +37,11 @@ LiberationSerif-BoldItalic.ttf::FontFile::6973589459942031632::1679252065::16816
|
||||
LiberationSerif-Italic.ttf::FontFile::3429051925918376143::1679252065::1681665020::1::::<><>::
|
||||
LiberationSerif-Regular.ttf::FontFile::3437532725077625275::1679252065::1681665020::1::::<><>::
|
||||
::res://CharacterCreator/::1659895857
|
||||
::res://databases/::1681669600
|
||||
::res://databases/::1682874550
|
||||
::res://Dialog/::1659895847
|
||||
::res://GenresSubstitution/::1681669646
|
||||
genre_sub.gd::GDScript::-1::1681669598::0::1::::<>Node<>::
|
||||
TestDB.tscn::PackedScene::3353206590719512815::1681669646::0::1::::<><>::res://GenresSubstitution/genre_sub.gd
|
||||
::res://GenresSubstitution/::1682274676
|
||||
genre_sub.gd::GDScript::-1::1682274676::0::1::::<>Node<>::
|
||||
TestDB.tscn::PackedScene::3353206590719512815::1682274676::0::1::::<><>::res://GenresSubstitution/genre_sub.gd
|
||||
::res://globalScripts/::1679252065
|
||||
DiceRoller.gd::GDScript::-1::1679252065::0::1::::<>Control<>::
|
||||
::res://Grammar/::1659895937
|
||||
|
@ -1,2 +1,3 @@
|
||||
res://GenresSubstitution/TestDB.tscn
|
||||
res://Dialog/TestDialog.tscn
|
||||
res://Dialog/dialog_system.gd
|
||||
res://GenresSubstitution/genre_sub.gd
|
||||
|
@ -10,4 +10,8 @@ run_reload_scripts=true
|
||||
[recent_files]
|
||||
|
||||
scenes=["res://GenresSubstitution/TestDB.tscn", "res://screens/MainMenu.tscn"]
|
||||
scripts=["res://GenresSubstitution/genre_sub.gd"]
|
||||
scripts=["res://Dialog/dialog_system.gd", "res://GenresSubstitution/genre_sub.gd"]
|
||||
|
||||
[script_setup]
|
||||
|
||||
last_selected_language="GDScript"
|
||||
|
@ -3,11 +3,25 @@
|
||||
state={
|
||||
"bookmarks": PackedInt32Array(),
|
||||
"breakpoints": PackedInt32Array(),
|
||||
"column": 25,
|
||||
"column": 42,
|
||||
"folded_lines": Array[int]([]),
|
||||
"h_scroll_position": 0,
|
||||
"row": 104,
|
||||
"scroll_position": 87.5,
|
||||
"row": 49,
|
||||
"scroll_position": 35.0,
|
||||
"selection": false,
|
||||
"syntax_highlighter": "GDScript"
|
||||
}
|
||||
|
||||
[res://Dialog/dialog_system.gd]
|
||||
|
||||
state={
|
||||
"bookmarks": PackedInt32Array(),
|
||||
"breakpoints": PackedInt32Array(),
|
||||
"column": 32,
|
||||
"folded_lines": Array[int]([]),
|
||||
"h_scroll_position": 0,
|
||||
"row": 84,
|
||||
"scroll_position": 72.0,
|
||||
"selection": false,
|
||||
"syntax_highlighter": "GDScript"
|
||||
}
|
||||
|
Binary file not shown.
@ -0,0 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://b8nsv6rdahxk1"]
|
||||
|
||||
[ext_resource type="Script" path="res://Dialog/dialog_system.gd" id="1_k1ism"]
|
||||
|
||||
[node name="TestDialog" type="Node2D"]
|
||||
script = ExtResource("1_k1ism")
|
@ -0,0 +1,106 @@
|
||||
extends Node
|
||||
|
||||
|
||||
# initialize the DB connection.
|
||||
# All Databases will be under res/databases/{Desired Database}
|
||||
|
||||
#How to init the connection with Godot 3.5+
|
||||
#const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns")
|
||||
#var db
|
||||
|
||||
#How to init the connection with godot 4+
|
||||
var db : SQLite = null
|
||||
const verbosity_level : int = SQLite.VERBOSE
|
||||
var db_name = "res://databases/dialog_system"
|
||||
#
|
||||
|
||||
|
||||
# A tag is a string used to identify a dialog option.
|
||||
# Examples of how to use createTag
|
||||
# createItem("streetVendor1InMainCityGreetingA")
|
||||
# createItem("dreamSequence1EndingOptionB")
|
||||
func createTag(inputNameString):
|
||||
db.open_db()
|
||||
var tableName = "Tag"
|
||||
var dict : Dictionary = Dictionary()
|
||||
dict["tagName"] = inputNameString
|
||||
db.insert_row(tableName,dict)
|
||||
print(dict)
|
||||
|
||||
|
||||
# A collection will contain the ID of the item in question, followed by the genre name, and the alias provided.
|
||||
# Examples of how to use createCollection
|
||||
# createCollection(3, "SciFi", "Plasma Pistol")
|
||||
# createCollection(3, "ModernDay", "9MM Handgun")
|
||||
# createCollection(3, "Fantasy", "Shortbow")
|
||||
func createDialog(dialogText, tagID):
|
||||
db.open_db()
|
||||
var tableName = "Dialog"
|
||||
var dict : Dictionary = Dictionary()
|
||||
dict["dialogText"] = dialogText
|
||||
dict["tagID"] = tagID
|
||||
db.insert_row(tableName,dict)
|
||||
print(dict)
|
||||
|
||||
|
||||
#This will read all tags in the entire database.
|
||||
#Just call this function to return them.
|
||||
func readTags():
|
||||
db.open_db()
|
||||
var tableName = "Tag"
|
||||
db.query("select * from " + tableName)
|
||||
for i in range(0, db.query_result.size()):
|
||||
print("Query results ", db.query_result[i]["tagName"], db.query_result[i]["primaryKey"])
|
||||
return db.query_result
|
||||
|
||||
|
||||
#This will read all Dialogs in the entire database.
|
||||
#Just call this function to return them.
|
||||
func readDialogs():
|
||||
db.open_db()
|
||||
var tableName = "Dialog"
|
||||
db.query("select * from " + tableName)
|
||||
for i in range(0, db.query_result.size()):
|
||||
print("Query results ", db.query_result[i]["dialogText"], db.query_result[i]["tagID"], db.query_result[i]["primaryKey"])
|
||||
return db.query_result
|
||||
|
||||
#Updating a tab may be useful when the name needs to be changed.
|
||||
#Example of how to use updateTagByID:
|
||||
#updateTagByID(23, introToNPCLisa)
|
||||
func updateTagByID(id, feedText):
|
||||
db.open_db()
|
||||
var tableName = "Tag"
|
||||
db.query("update " + str(tableName) + " set tagName = " + "\"" + str(feedText) + "\"" + " where primaryKey = " + str(id) + ";")
|
||||
return db.query_result
|
||||
|
||||
#Updating a dialog option may be useful when the content or context needs to be changed.
|
||||
#Example of how to updateDialogByID
|
||||
#updateDialogByID(47, "What'cha Buying, What'cha Selling?")
|
||||
func updateDialogByID(id, feedText):
|
||||
db.open_db()
|
||||
var tableName = "Dialog"
|
||||
db.query("update " + str(tableName) + " set dialogText = " + "\"" + str(feedText) + "\"" + " where primaryKey = " + str(id) + ";")
|
||||
return db.query_result
|
||||
|
||||
#Example of how to updateTagByID
|
||||
#updateTagByID(23)
|
||||
func deleteTagByID(id):
|
||||
db.open_db()
|
||||
var tableName = "Tag"
|
||||
db.query("delete from " + tableName + " where primaryKey = " + str(id))
|
||||
print("Deleted Tag by ID " + str(id) + ".")
|
||||
|
||||
#Example of how to deleteDialogByID
|
||||
#updateDialogByID(47)
|
||||
func deleteDialogByID(id):
|
||||
db.open_db()
|
||||
var tableName = "Dialog"
|
||||
db.query("delete from " + tableName + " where primaryKey = " + str(id))
|
||||
print("Deleted Dialog by ID " + str(id) + ".")
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
db = SQLite.new()
|
||||
db.path = db_name
|
||||
pass # Replace with function body.
|
@ -144,5 +144,4 @@ func deleteCollectionByID(id):
|
||||
func _ready():
|
||||
db = SQLite.new()
|
||||
db.path = db_name
|
||||
updateCollectionGenreByID(1, "Cowboys VS Aliens")
|
||||
pass # Replace with function body.
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user