Pushed new changes and added a node for error handling

This commit is contained in:
PersonGuyGit 2022-07-03 12:29:29 -06:00
parent 2cb9448f73
commit 9296dcacf6
6 changed files with 213 additions and 65 deletions

View File

@ -29,6 +29,13 @@ 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/HBoxErrorSignRow/Popup")
#
#onready var errorLabel = get_node("Panel/HBoxErrorSignRow/Popup/ErrorLabel")
var iniFile = ConfigFile.new()
func saveToInstance():
@ -45,14 +52,6 @@ func saveToInstance():
saveObject.settingsInstance.themeChoice = themeChoiceList.get_selected_items()
## TO DO
## Make Theme and Keyboard Options Tie To Their Enunms
#Add Theme and Keyboard Selections to singeton
print("Save Object Below!!!")
print(saveObject)
func saveFile():
iniFile.set_value("player_preferences", "player_name", NameVar.text)
@ -87,7 +86,11 @@ func loadFile():
func _process(delta):
if saveButton.pressed == true:
if NameVar.text == "":
print("Please input a name")
#errorLabel.text = "Please input a name!"
#errorPopup.popup()
else:
# Save to the template instance
saveToInstance()
@ -95,7 +98,7 @@ func _process(delta):
print('saveFileRan')
func _ready():
theme=load("res://assets/ui_controlNode_dark_theme.tres")
theme=load("res://assets/ui_controlNode_light_theme.tres")
for i in range(3):
keyboardLayoutList.add_item(keyboardContents[i],null,true)

View File

@ -30,6 +30,7 @@ margin_left = -298.5
margin_right = 298.5
margin_bottom = 19.0
custom_constants/separation = 60
alignment = 1
[node name="RootVboxVisualControls" type="VBoxContainer" parent="Panel/HBoxContainer"]
margin_right = 98.0
@ -275,19 +276,28 @@ auto_height = true
[node name="HBoxBottomRow" type="HBoxContainer" parent="Panel"]
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
margin_left = -48.5
margin_top = -20.0
margin_top = 200.0
margin_right = 48.5
margin_bottom = 20.0
margin_bottom = 25.0
[node name="SaveButton" type="Button" parent="Panel/HBoxBottomRow"]
margin_top = -100.0
margin_right = 97.0
margin_bottom = -70.0
margin_bottom = 25.0
text = "Save Settings"
__meta__ = {
"_edit_use_anchors_": false
}
[node name="HBoxErrorRow" type="HBoxContainer" parent="Panel"]
margin_right = 40.0
margin_bottom = 40.0
[node name="ErrorPopup" type="Popup" parent="Panel/HBoxErrorRow"]
margin_right = 40.0
margin_bottom = 40.0
[node name="ErrorLabel" type="Label" parent="Panel/HBoxErrorRow/ErrorPopup"]
margin_right = 40.0
margin_bottom = 19.0

View File

@ -18,8 +18,8 @@ Button/styles/hover = null
Button/styles/normal = ExtResource( 1 )
Button/styles/pressed = ExtResource( 1 )
ItemList/colors/font_color = Color( 0, 0, 0, 1 )
ItemList/colors/font_color_selected = Color( 1, 1, 1, 1 )
ItemList/colors/guide_color = Color( 0, 0, 0, 0.1 )
ItemList/colors/font_color_selected = Color( 0.227451, 0.227451, 0.227451, 1 )
ItemList/colors/guide_color = Color( 0.235294, 0.231373, 0.231373, 0.847059 )
ItemList/constants/hseparation = 4
ItemList/constants/icon_margin = 4
ItemList/constants/line_separation = 2
@ -27,10 +27,10 @@ ItemList/constants/vseparation = 2
ItemList/fonts/font = null
ItemList/styles/bg = ExtResource( 1 )
ItemList/styles/bg_focus = ExtResource( 1 )
ItemList/styles/cursor = null
ItemList/styles/cursor = ExtResource( 1 )
ItemList/styles/cursor_unfocused = ExtResource( 1 )
ItemList/styles/selected = null
ItemList/styles/selected_focus = null
ItemList/styles/selected = ExtResource( 1 )
ItemList/styles/selected_focus = ExtResource( 1 )
Label/colors/font_color = Color( 0, 0, 0, 1 )
Label/colors/font_color_shadow = Color( 0, 0, 0, 0 )
Label/colors/font_outline_modulate = Color( 1, 1, 1, 1 )

View File

@ -1,17 +1,9 @@
extends Node
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Declare new settings template object
var settingsInstance = PlayerSettingsTemplate.new()
# 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
pass

View File

@ -2,17 +2,7 @@ extends Node
class_name PlayerSettingsTemplate
enum KeyboardLayout {
QWERTY,
ALPHABETICAL,
DVORAK
}
enum ThemeChoice {
DARKHIGHCONTRAST,
LIGHTHIGHCONTRAST
}
# Declare Setting Options, to be used inside of the settings menu
var inputName = "none"
var riskFactor = 0
var brightness = 3
@ -21,21 +11,12 @@ 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
#var preferredTheme = ThemeChoice.DARKHIGHCONTRAST
# 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
pass