diff --git a/Phase2/Godot_Toolset/Luke/DataStorage/database.db b/Phase2/Godot_Toolset/Luke/DataStorage/database.db index 999edae..5a7f8e5 100644 Binary files a/Phase2/Godot_Toolset/Luke/DataStorage/database.db and b/Phase2/Godot_Toolset/Luke/DataStorage/database.db differ diff --git a/Phase2/Godot_Toolset/Luke/MainSystem.gd b/Phase2/Godot_Toolset/Luke/MainSystem.gd index b4b99ab..d88f092 100644 --- a/Phase2/Godot_Toolset/Luke/MainSystem.gd +++ b/Phase2/Godot_Toolset/Luke/MainSystem.gd @@ -4,18 +4,29 @@ const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns") var db # Database object var db_name = "res://DataStorage/database" +onready var only_once : bool = true + +onready var textEntry = get_node("VBoxContainer/LineEdit") +onready var convoID = get_node("VBoxContainer/HBoxContainer/labelConvoID/LineEdit") +onready var layerID = get_node("VBoxContainer/HBoxContainer/labelLayerID/LineEdit") +onready var branchID = get_node("VBoxContainer/HBoxContainer/labelBranchID/LineEdit") + +onready var saveButton = get_node("saveButton") + func CommitDataToDB(): db = SQLite.new() db.path = db_name db.open_db() var tableName = "DataStorage" var dict : Dictionary = Dictionary() - dict["ConvoID"] = 1 - dict["LayerID"] = 1 - dict["BranchID"] = 1 - dict["Text"] = "The best riff from Freebird plays at 202 dB." + dict["ConvoID"] = int(convoID.text) + dict["LayerID"] = int(layerID.text) + dict["BranchID"] = int(branchID.text) + dict["Text"] = textEntry.text db.insert_row(tableName,dict) + + print("Done with SQL commit") func readFromDB(): db = SQLite.new() @@ -39,5 +50,11 @@ func DeleteFromDBByID(idNum): # Called when the node enters the scene tree for the first time. func _ready(): - DeleteFromDBByID(1) + pass + +func _process(delta): + if saveButton.pressed == true && only_once == true: + only_once = false + CommitDataToDB() + diff --git a/Phase2/Godot_Toolset/Luke/Scenes/DialogEditor.tscn b/Phase2/Godot_Toolset/Luke/Scenes/DialogEditor.tscn index b0acd45..817d32b 100644 --- a/Phase2/Godot_Toolset/Luke/Scenes/DialogEditor.tscn +++ b/Phase2/Godot_Toolset/Luke/Scenes/DialogEditor.tscn @@ -2,5 +2,84 @@ [ext_resource path="res://MainSystem.gd" type="Script" id=1] -[node name="Node2D" type="Node2D"] +[node name="Control" type="Control"] +anchor_right = 1.0 +anchor_bottom = 1.0 script = ExtResource( 1 ) + +[node name="Panel" type="Panel" parent="."] +anchor_right = 1.0 +anchor_bottom = 1.0 + +[node name="Label" type="Label" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -40.5 +margin_right = 40.5 +margin_bottom = 14.0 +text = "Dialog Editor" + +[node name="VBoxContainer" type="VBoxContainer" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -200.0 +margin_top = 100.0 +margin_right = 200.0 +margin_bottom = 200.0 + +[node name="Label" type="Label" parent="VBoxContainer"] +margin_right = 400.0 +margin_bottom = 14.0 +text = "Dialog Text" + +[node name="LineEdit" type="LineEdit" parent="VBoxContainer"] +margin_top = 18.0 +margin_right = 400.0 +margin_bottom = 42.0 + +[node name="HBoxContainer" type="HBoxContainer" parent="VBoxContainer"] +margin_top = 46.0 +margin_right = 400.0 +margin_bottom = 60.0 +custom_constants/separation = 4 + +[node name="labelConvoID" type="Label" parent="VBoxContainer/HBoxContainer"] +margin_right = 58.0 +margin_bottom = 14.0 +text = "Convo ID" + +[node name="LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer/labelConvoID"] +margin_top = 20.0 +margin_right = 58.0 +margin_bottom = 24.0 + +[node name="labelLayerID" type="Label" parent="VBoxContainer/HBoxContainer"] +margin_left = 62.0 +margin_right = 115.0 +margin_bottom = 14.0 +text = "Layer ID" + +[node name="LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer/labelLayerID"] +margin_top = 20.0 +margin_right = 58.0 +margin_bottom = 24.0 + +[node name="labelBranchID" type="Label" parent="VBoxContainer/HBoxContainer"] +margin_left = 119.0 +margin_right = 182.0 +margin_bottom = 14.0 +text = "Branch ID" + +[node name="LineEdit" type="LineEdit" parent="VBoxContainer/HBoxContainer/labelBranchID"] +margin_top = 20.0 +margin_right = 58.0 +margin_bottom = 24.0 + +[node name="saveButton" type="Button" parent="."] +anchor_left = 0.5 +anchor_right = 0.5 +margin_left = -49.5 +margin_top = 250.0 +margin_right = 49.5 +margin_bottom = 20.0 +text = "Commit Entry"