mirror of
https://github.com/RPG-Research/bcirpg.git
synced 2024-04-16 14:23:01 +00:00
Cleaned up the repo, added some changes to my documentation (not pushed yet), and started a popup error system.
This commit is contained in:
parent
ab2d1a8840
commit
ecf2d792cb
@ -1,38 +0,0 @@
|
||||
# Welcome to Project Ilmatar!
|
||||
|
||||
Hello, This is Luke's Documentation for **Project Ilmatar**. This will be a way to get a reference as to what is going on under the hood of my portions of code so far.
|
||||
|
||||
# Die Roller ///Die.gd///
|
||||
|
||||
The Die roller I created is based on an *emum* datatype called **DieCategory**. This die roller will take in the Parameter of the Die type you want to roll. It will then seed a random number generator and create a die outcome that is appropriate to the die type chosen.
|
||||
|
||||
1. First, you need to set the DieType variable to one of the vars inside of DieCategory. Example DieCategory.D00.
|
||||
2. Then you must call SetNumberOfSides(), this will prime the die roller to have the correct DieType.
|
||||
3. Then you can call RollDie(NumberOfFaces), to roll the die; and return a value and a success rate in terms of a %.
|
||||
|
||||
|
||||
# Save and Load Game ///SaveAndLoadGame.gd///
|
||||
|
||||
This version of the save and load game system, requires SQLite.
|
||||
The implementation is a basic test at the moment, but full functionality should be able to be added as the projects data increases.
|
||||
|
||||
To use SQLite you will need to use the SQLite plugin for Godot from 2Shady4u *It's trust worthy, despite the name*....
|
||||
|
||||
You will also need to install DBBrowser for SQLite. This will allow you to create table objects, which you will then enter data into using Godot.
|
||||
|
||||
|
||||
# Date And Time ///Date.gd///
|
||||
This class is an extension of Date.gd from vanskodje-godotengine / godot-plugin-calendar-button .
|
||||
|
||||
This class allows for you to read date and time objects.
|
||||
|
||||
Ideally this class will be used to give time stamps for how old save games are.
|
||||
|
||||
Could also be used to set in game timers and time limits, as well.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,86 +0,0 @@
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://userInterface/But_ChangeScene.tscn" type="PackedScene" id=1]
|
||||
[ext_resource path="res://userInterface/Title.tscn" type="PackedScene" id=5]
|
||||
[ext_resource path="res://assets/background_demo.png" type="Texture" id=7]
|
||||
[ext_resource path="res://assets/ui_theme.tres" type="Theme" id=8]
|
||||
[ext_resource path="res://assets/ui_title_theme.tres" type="Theme" id=9]
|
||||
[ext_resource path="res://userInterface/But_Quit.tscn" type="PackedScene" id=10]
|
||||
|
||||
[node name="MenuScreen" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
theme = ExtResource( 8 )
|
||||
|
||||
[node name="background_demo" type="TextureRect" parent="."]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
texture = ExtResource( 7 )
|
||||
expand = true
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Title" parent="." instance=ExtResource( 5 )]
|
||||
margin_top = 51.8676
|
||||
margin_bottom = 117.868
|
||||
theme = ExtResource( 9 )
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -119.0
|
||||
margin_top = -152.0
|
||||
margin_right = 119.0
|
||||
margin_bottom = 152.0
|
||||
rect_scale = Vector2( 1.04675, 1.07389 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="But_NewGame" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_right = 238.0
|
||||
margin_bottom = 48.0
|
||||
|
||||
[node name="But_LoadGame" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 52.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 101.0
|
||||
text = "Load Game"
|
||||
|
||||
[node name="But_Multiplayer" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 105.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 154.0
|
||||
text = "Multiplayer"
|
||||
|
||||
[node name="But_AddChar" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 158.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 207.0
|
||||
text = "Add Character"
|
||||
|
||||
[node name="But_Settings" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 211.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 259.0
|
||||
text = "Settings"
|
||||
|
||||
[node name="But_Quit" parent="VBoxContainer" instance=ExtResource( 10 )]
|
||||
margin_top = 263.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 303.0
|
||||
|
||||
[node name="Version" type="Label" parent="."]
|
||||
anchor_left = 1.0
|
||||
anchor_top = 1.0
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -165.0
|
||||
margin_top = -38.0
|
||||
text = "Version: 0.0.0"
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
extends Node
|
||||
|
||||
|
||||
var bIsDarkThemeOn = false
|
||||
var settingsFile = "user://settings.cfg"
|
||||
var playerSettingsSingleton = PlayerSettingsTemplate.new()
|
||||
|
||||
|
||||
|
||||
|
||||
func make_settings_file():
|
||||
var config = ConfigFile.new()
|
||||
|
||||
config.set_value("Player", "InputName", "Default Name")
|
||||
config.set_value("Player", "riskFactor", 0)
|
||||
config.set_value("Player", "brightness", 3)
|
||||
config.set_value("Player", "fontSize", 11)
|
||||
config.set_value("Player", "volume", 6)
|
||||
var bClosedCaptions = config.set_value("player", "bClosedCaptions")
|
||||
var bDevConsole = config.set_value("Player", "bDevConsole")
|
||||
var bVirtualKeyboard = config.set_value("Player", "bVirtualKeyboard", false)
|
||||
var preferredTheme = config.set_value("Player", "preferredTheme", PlayerSettingsTemplate.ThemeChoice.LIGHTHIGHCONTRAST)
|
||||
var visualKeyboardLayout = config.set_value("Player", "visualKeyboardLayout", PlayerSettingsTemplate.KeyboardLayout.QWERTY)
|
||||
|
||||
config.save("user://settings.cfg")
|
||||
|
||||
|
||||
|
||||
#Config/ini:
|
||||
func load_settings_file():
|
||||
var config = ConfigFile.new()
|
||||
# Load data from a file.
|
||||
var err = config.load(settingsFile)
|
||||
# If the file didn't load, ignore it.
|
||||
if err != OK:
|
||||
return
|
||||
for player in config.get_sections():
|
||||
var inputName = config.get_value(player, "InputSettings")
|
||||
var riskFactor = config.get_value(player, "riskFactor")
|
||||
var brightness = config.get_value(player, "brightness")
|
||||
var fontSize = config.get_value(player, "fontSize")
|
||||
var volume = config.get_value(player, "volume")
|
||||
var bClosedCaptions = config.get_value(player, "bClosedCaptions")
|
||||
var bDevConsole = config.get_value(player, "bDevConsole")
|
||||
var bVirtualKeyboard = config.get_value(player, "bVirtualKeyboard")
|
||||
var preferredTheme = config.get_value(player, "preferredTheme")
|
||||
var visualKeyboardLayout = config.get_value(player, "visualKeyboardLayout")
|
||||
|
||||
print("Input name loaded as: " + inputName)
|
||||
|
||||
playerSettingsSingleton.inputName = inputName
|
||||
playerSettingsSingleton.riskFactor = riskFactor
|
||||
|
||||
|
||||
|
||||
|
||||
#func EnableGlobalThemes(bDark):
|
||||
#if (bDark == true):
|
||||
##controlNode.theme=load("res://assets/ui_controlNode_dark_theme.tres")
|
||||
|
||||
#if (bDark == false):
|
||||
##controlNode.theme=load("res://assets/ui_controlNode_light_theme.tres")
|
||||
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
@ -0,0 +1,17 @@
|
||||
extends Node
|
||||
|
||||
#Forked from the code found in this video
|
||||
# https://www.youtube.com/watch?v=QnYtCSZR2iA
|
||||
|
||||
|
||||
export var display_time: float = 5
|
||||
export var display_text: String = "text"
|
||||
export var error_code: int = 0
|
||||
|
||||
onready var popup_scene = load('res://dynamic_popups/popup.tscn')
|
||||
|
||||
func on_button_pressed():
|
||||
var new_popup = popup_scene.instance()
|
||||
new_popup.show_time = display_time
|
||||
new_popup.text_to_show = display_text
|
||||
add_child(new_popup)
|
@ -0,0 +1,16 @@
|
||||
extends Node
|
||||
|
||||
|
||||
# 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,16 @@
|
||||
[gd_scene format=2]
|
||||
|
||||
[node name="Control" type="Control"]
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 0.5
|
||||
margin_left = -45.5
|
||||
margin_top = -10.0
|
||||
margin_right = 45.5
|
||||
margin_bottom = 10.0
|
||||
text = "Close Popup"
|
@ -1,4 +1,3 @@
|
||||
extends Node
|
||||
|
||||
class_name PlayerSettingsTemplate
|
||||
|
||||
|
@ -12,7 +12,7 @@ _global_script_classes=[ {
|
||||
"base": "Node",
|
||||
"class": "PlayerSettingsTemplate",
|
||||
"language": "GDScript",
|
||||
"path": "res://playerSettingsTemplate.gd"
|
||||
"path": "res://settings/playerSettingsTemplate.gd"
|
||||
} ]
|
||||
_global_script_class_icons={
|
||||
"PlayerSettingsTemplate": ""
|
||||
@ -21,12 +21,14 @@ _global_script_class_icons={
|
||||
[application]
|
||||
|
||||
config/name="BCIRPGR_mainMenu"
|
||||
run/main_scene="res://Screens/MenuScreen.tscn"
|
||||
run/main_scene="res://screens/MenuScreen.tscn"
|
||||
config/icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
GlobalSaveInstance="*res://globalSaveInstance.gd"
|
||||
SettingsMenuConfig="*res://SettingsMenuConfig.gd"
|
||||
SettingsMenuControl="*res://SettingsMenuControl.tscn"
|
||||
|
||||
[physics]
|
||||
|
||||
|
@ -42,36 +42,36 @@ __meta__ = {
|
||||
|
||||
[node name="But_NewGame" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_right = 238.0
|
||||
margin_bottom = 49.0
|
||||
margin_bottom = 50.0
|
||||
|
||||
[node name="But_LoadGame" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 53.0
|
||||
margin_top = 54.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 103.0
|
||||
margin_bottom = 104.0
|
||||
text = "Load Game"
|
||||
|
||||
[node name="But_Multiplayer" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 107.0
|
||||
margin_top = 108.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 156.0
|
||||
margin_bottom = 158.0
|
||||
text = "Multiplayer"
|
||||
|
||||
[node name="But_AddChar" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 160.0
|
||||
margin_top = 162.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 210.0
|
||||
margin_bottom = 212.0
|
||||
text = "Add Character"
|
||||
|
||||
[node name="But_Settings" parent="VBoxContainer" instance=ExtResource( 1 )]
|
||||
margin_top = 214.0
|
||||
margin_top = 216.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 263.0
|
||||
margin_bottom = 266.0
|
||||
text = "Settings"
|
||||
|
||||
[node name="But_Quit" parent="VBoxContainer" instance=ExtResource( 10 )]
|
||||
margin_top = 267.0
|
||||
margin_top = 270.0
|
||||
margin_right = 238.0
|
||||
margin_bottom = 303.0
|
||||
margin_bottom = 304.0
|
||||
|
||||
[node name="Version" type="Label" parent="."]
|
||||
anchor_left = 1.0
|
||||
|
@ -6,9 +6,6 @@
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
script = ExtResource( 1 )
|
||||
__meta__ = {
|
||||
"_edit_use_anchors_": false
|
||||
}
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
anchor_right = 1.0
|
||||
@ -205,7 +202,7 @@ margin_right = 157.0
|
||||
margin_bottom = 24.0
|
||||
|
||||
[node name="Button" type="Button" parent="Panel/Label3/VBoxContainer"]
|
||||
margin_top = 124.0
|
||||
margin_top = 94.0
|
||||
margin_right = 157.0
|
||||
margin_bottom = 114.0
|
||||
text = "Save Changes"
|
||||
|
@ -9,10 +9,11 @@ onready var keyboardContents = ["Qwerty", "Dvorak", "Alphabetical"]
|
||||
|
||||
onready var themeContents = ["White on Black", "Black on White"]
|
||||
|
||||
|
||||
onready var saveObject = get_node('/root/GlobalSaveInstance')
|
||||
|
||||
|
||||
#res://SettingsMenuControl.tscn
|
||||
|
||||
# Vars For UI Widgets
|
||||
onready var NameVar = get_node('Panel/HBoxContainer/RootVboxPlayerPreferences/Label/VBoxPlayerPreferances/DisplayNameLineEdit')
|
||||
|
||||
@ -37,12 +38,6 @@ onready var keyboardLayoutList = get_node('Panel/HBoxContainer/RootVboxVisualCon
|
||||
onready var themeChoiceList = get_node('Panel/HBoxContainer/RootVboxVisualControls2/Label2/VBoxContainer/ThemeItemList')
|
||||
|
||||
|
||||
# Imports related to error handling and popups for said errors
|
||||
|
||||
onready var errorPopup = get_node("Panel/HBoxErrorRow/CenterContainer/ErrorPopup")
|
||||
|
||||
onready var errorLabel = get_node("Panel/HBoxErrorRow/CenterContainer/ErrorPopup/ErrorLabel")
|
||||
|
||||
var iniFile = ConfigFile.new()
|
||||
|
||||
func saveToInstance():
|
||||
@ -95,9 +90,6 @@ func _process(delta):
|
||||
if saveButton.pressed == true:
|
||||
if NameVar.text == "":
|
||||
print("Please input a name")
|
||||
errorLabel.text = str("Please Input A Name")
|
||||
errorPopup.popup()
|
||||
|
||||
|
||||
if NameVar.text != "":
|
||||
# Save to the template instance
|
||||
@ -107,7 +99,9 @@ func _process(delta):
|
||||
print('saveFileRan')
|
||||
|
||||
func _ready():
|
||||
theme=load("res://assets/ui_controlNode_light_theme.tres")
|
||||
theme=load("res://assets/ui_controlNode_dark_theme.tres")
|
||||
|
||||
print(NameVar.get_path())
|
||||
|
||||
# Init Keyboard Layout List
|
||||
for i in range(3):
|
@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=4 format=2]
|
||||
|
||||
[ext_resource path="res://SettingsMenuConfig.gd" type="Script" id=1]
|
||||
[ext_resource path="res://settings/SettingsMenuConfig.gd" type="Script" id=1]
|
||||
[ext_resource path="res://assets/liberation_serif.tres" type="DynamicFont" id=2]
|
||||
|
||||
[sub_resource type="Theme" id=3]
|
||||
@ -289,24 +289,3 @@ __meta__ = {
|
||||
margin_right = 97.0
|
||||
margin_bottom = 25.0
|
||||
text = "Save Settings"
|
||||
|
||||
[node name="HBoxErrorRow" type="HBoxContainer" parent="Panel"]
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
margin_left = -20.0
|
||||
margin_top = -100.0
|
||||
margin_right = 20.0
|
||||
margin_bottom = -100.0
|
||||
alignment = 1
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="Panel/HBoxErrorRow"]
|
||||
margin_left = 20.0
|
||||
margin_right = 20.0
|
||||
|
||||
[node name="ErrorPopup" type="Popup" parent="Panel/HBoxErrorRow/CenterContainer"]
|
||||
|
||||
[node name="ErrorLabel" type="Label" parent="Panel/HBoxErrorRow/CenterContainer/ErrorPopup"]
|
||||
margin_right = 40.0
|
||||
margin_bottom = 19.0
|
@ -0,0 +1,22 @@
|
||||
extends Node
|
||||
|
||||
class_name PlayerSettingsTemplate
|
||||
|
||||
# Declare Setting Options, to be used inside of the settings menu
|
||||
var inputName = "none"
|
||||
var riskFactor = 0
|
||||
var brightness = 3
|
||||
var fontSize = 11
|
||||
var volume = 6
|
||||
var bClosedCaptions = true
|
||||
var bdevConsole = false
|
||||
var bVirtualKeyboard = false
|
||||
|
||||
# Setting of 0 is Qwerty, Setting of 1 is Davorak, Setting of 2 is Alphabetical
|
||||
var visualKeyboardLayout = 0
|
||||
|
||||
# Setting of 0 is dark, setting of 1 is light, and so on
|
||||
var themeChoice = 0
|
||||
|
||||
func _ready():
|
||||
pass
|
Loading…
Reference in New Issue
Block a user