diff --git a/Godot/MainMenu/GodotUserInterface_Luke/.import/.gdignore b/Godot/MainMenu/GodotUserInterface_Luke/.import/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Luke/.import/.gdignore @@ -0,0 +1 @@ + diff --git a/Godot/MainMenu/GodotUserInterface_Luke/DataStore/database.db b/Godot/MainMenu/GodotUserInterface_Luke/DataStore/database.db index adb7539..9d3e418 100644 Binary files a/Godot/MainMenu/GodotUserInterface_Luke/DataStore/database.db and b/Godot/MainMenu/GodotUserInterface_Luke/DataStore/database.db differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/GUI.gd b/Godot/MainMenu/GodotUserInterface_Luke/GUI.gd new file mode 100644 index 0000000..12f04f8 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Luke/GUI.gd @@ -0,0 +1,38 @@ +extends MarginContainer + +const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns") +var db +var db_name = "res://DataStore/database" + +func _ready(): + db = SQLite.new() + db.path = db_name + #commitDataToDB() + readFromDB() + getItemsByUserID(1) + +func commitDataToDB(): + db.open_db() + var tableName = "PlayerInfo" + var dict : Dictionary = Dictionary() + dict["Name"] = "This is a test user1" + dict["Score"] = 6000 + db.insert_row(tableName,dict) + print("Row Inserted") + +func readFromDB(): + db.open_db() + var tableName = "PlayerInfo" + db.query("select * from " + tableName + ";") + for i in range(0,db.query_result.size()): + print("Query results ", db.query_result[i]["Name"], db.query_result[i]) + +func getItemsByUserID(id): + db.open_db() + + #To Do, we should probably make this more generic, so it can query differnt tables + + db.query("select playerinfo.name as pname, ItemIventory.name as iname from playerinfo left join ItemIventory on playerinfo.ID = ItemIventory.PlayerID where playerinfo.id = " + str(id)) + for i in range(0, db.query_result.size()): + print("Query results ", db.query_result[i]["pname"], db.query_result[i]["iname"]) + return db.query_result diff --git a/Godot/MainMenu/GodotUserInterface_Luke/GUI.tscn b/Godot/MainMenu/GodotUserInterface_Luke/GUI.tscn index c8d592d..6ff3a4c 100644 --- a/Godot/MainMenu/GodotUserInterface_Luke/GUI.tscn +++ b/Godot/MainMenu/GodotUserInterface_Luke/GUI.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=4 format=2] +[gd_scene load_steps=5 format=2] [ext_resource path="res://Player_Settings_Button.gd" type="Script" id=1] [ext_resource path="res://HostAndJoinGame.gd" type="Script" id=2] [ext_resource path="res://Start Game.gd" type="Script" id=3] +[ext_resource path="res://GUI.gd" type="Script" id=4] [node name="GUI" type="MarginContainer"] anchor_right = 1.0 @@ -13,6 +14,7 @@ custom_constants/margin_right = 120 custom_constants/margin_top = 80 custom_constants/margin_left = 120 custom_constants/margin_bottom = 80 +script = ExtResource( 4 ) __meta__ = { "_edit_use_anchors_": false } @@ -79,6 +81,7 @@ margin_top = 213.0 margin_right = 367.0 margin_bottom = 227.0 text = "Test Menu" + [connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/Start Game" to="HBoxContainer/VBoxContainer/MenuOptions/Start Game" method="_on_Start_Game_gui_input"] [connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/Load Game" to="HBoxContainer/VBoxContainer/MenuOptions/Load Game" method="_on_Start_Game_gui_input"] [connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/HostAndJoinGame" to="HBoxContainer/VBoxContainer/MenuOptions/HostAndJoinGame" method="_on_HostAndJoinGame_gui_input"] diff --git a/Godot/MainMenu/GodotUserInterface_Luke/MainSystem.gd b/Godot/MainMenu/GodotUserInterface_Luke/MainSystem.gd index c4bce47..e69de29 100644 --- a/Godot/MainMenu/GodotUserInterface_Luke/MainSystem.gd +++ b/Godot/MainMenu/GodotUserInterface_Luke/MainSystem.gd @@ -1,16 +0,0 @@ -extends MarginContainer - - -# Declare member variables here. Examples: -# var a = 2 -# var b = "text" - - -# Called when the node enters the scene tree for the first time. -func _ready(): - pass # Replace with function body. - - -# Called every frame. 'delta' is the elapsed time since the previous frame. -#func _process(delta): -# pass diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/LICENSE.md b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/LICENSE.md new file mode 100644 index 0000000..6e6ce30 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/LICENSE.md @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019-2021 Piet Bronders & Jeroen De Geeter + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so new file mode 100644 index 0000000..7a6e780 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/arm64-v8a/libgdsqlite.so differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so new file mode 100644 index 0000000..3bfcb2a Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/armeabi-v7a/libgdsqlite.so differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/x86/libgdsqlite.so b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/x86/libgdsqlite.so new file mode 100644 index 0000000..0efcf27 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/android/x86/libgdsqlite.so differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/bin/gdsqlite.gdnlib b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/gdsqlite.gdnlib similarity index 100% rename from Godot/MainMenu/GodotUserInterface_Luke/bin/gdsqlite.gdnlib rename to Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/gdsqlite.gdnlib diff --git a/Godot/MainMenu/GodotUserInterface_Luke/gdsqlite.gdns b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/gdsqlite.gdns similarity index 88% rename from Godot/MainMenu/GodotUserInterface_Luke/gdsqlite.gdns rename to Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/gdsqlite.gdns index 6692994..2f01a53 100644 --- a/Godot/MainMenu/GodotUserInterface_Luke/gdsqlite.gdns +++ b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/gdsqlite.gdns @@ -5,4 +5,4 @@ [resource] resource_name = "gdsqlite" class_name = "SQLite" -library = ExtResource( 1 ) +library = ExtResource( 1 ) \ No newline at end of file diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a new file mode 100644 index 0000000..4e6a4e0 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/ios/arm64/libgdsqlite.a differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a new file mode 100644 index 0000000..902e70a Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/ios/armv7/libgdsqlite.a differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm new file mode 100644 index 0000000..7faff54 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/javascript/libgdsqlite.wasm differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/osx/libgdsqlite.dylib b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/osx/libgdsqlite.dylib new file mode 100644 index 0000000..81a34ec Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/osx/libgdsqlite.dylib differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/win64/libgdsqlite.dll b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/win64/libgdsqlite.dll new file mode 100644 index 0000000..d810139 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/win64/libgdsqlite.dll differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/x11/libgdsqlite.so b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/x11/libgdsqlite.so new file mode 100644 index 0000000..9e10f67 Binary files /dev/null and b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/bin/x11/libgdsqlite.so differ diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/godot-sqlite.gd b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/godot-sqlite.gd new file mode 100644 index 0000000..228ff4e --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/godot-sqlite.gd @@ -0,0 +1,14 @@ +# ############################################################################ # +# Copyright © 2019-2021 Piet Bronders & Jeroen De Geeter +# Licensed under the MIT License. +# See LICENSE in the project root for license information. +# ############################################################################ # + +tool +extends EditorPlugin + +func _enter_tree(): + pass + +func _exit_tree(): + pass diff --git a/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/plugin.cfg b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/plugin.cfg new file mode 100644 index 0000000..b46f493 --- /dev/null +++ b/Godot/MainMenu/GodotUserInterface_Luke/addons/godot-sqlite/plugin.cfg @@ -0,0 +1,7 @@ +[plugin] + +name="Godot SQLite" +description="GDNative wrapper for SQLite (Godot 3.2+), making it possible to use SQLite databases as data storage in all your future games." +author="Piet Bronders & Jeroen De Geeter" +version="3.0" +script="godot-sqlite.gd"