mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Created the basic hook for the SQLite Database. Also need my eyes checked lol.
This commit is contained in:
parent
770abfa3df
commit
292a4c0871
1
Godot/MainMenu/GodotUserInterface_Luke/.import/.gdignore
Normal file
1
Godot/MainMenu/GodotUserInterface_Luke/.import/.gdignore
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
Binary file not shown.
38
Godot/MainMenu/GodotUserInterface_Luke/GUI.gd
Normal file
38
Godot/MainMenu/GodotUserInterface_Luke/GUI.gd
Normal file
@ -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
|
@ -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://Player_Settings_Button.gd" type="Script" id=1]
|
||||||
[ext_resource path="res://HostAndJoinGame.gd" type="Script" id=2]
|
[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://Start Game.gd" type="Script" id=3]
|
||||||
|
[ext_resource path="res://GUI.gd" type="Script" id=4]
|
||||||
|
|
||||||
[node name="GUI" type="MarginContainer"]
|
[node name="GUI" type="MarginContainer"]
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
@ -13,6 +14,7 @@ custom_constants/margin_right = 120
|
|||||||
custom_constants/margin_top = 80
|
custom_constants/margin_top = 80
|
||||||
custom_constants/margin_left = 120
|
custom_constants/margin_left = 120
|
||||||
custom_constants/margin_bottom = 80
|
custom_constants/margin_bottom = 80
|
||||||
|
script = ExtResource( 4 )
|
||||||
__meta__ = {
|
__meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_edit_use_anchors_": false
|
||||||
}
|
}
|
||||||
@ -79,6 +81,7 @@ margin_top = 213.0
|
|||||||
margin_right = 367.0
|
margin_right = 367.0
|
||||||
margin_bottom = 227.0
|
margin_bottom = 227.0
|
||||||
text = "Test Menu"
|
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/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/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"]
|
[connection signal="gui_input" from="HBoxContainer/VBoxContainer/MenuOptions/HostAndJoinGame" to="HBoxContainer/VBoxContainer/MenuOptions/HostAndJoinGame" method="_on_HostAndJoinGame_gui_input"]
|
||||||
|
@ -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
|
|
@ -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.
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,14 @@
|
|||||||
|
# ############################################################################ #
|
||||||
|
# Copyright © 2019-2021 Piet Bronders & Jeroen De Geeter <piet.bronders@gmail.com>
|
||||||
|
# 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
|
@ -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"
|
Loading…
Reference in New Issue
Block a user