2022-08-03 01:01:10 +00:00
|
|
|
extends Button
|
|
|
|
|
|
|
|
var config = ConfigFile.new()
|
|
|
|
|
2022-08-08 06:42:26 +00:00
|
|
|
onready var user_name = get_node("%textbox_user_name")
|
2022-08-07 01:08:10 +00:00
|
|
|
onready var user_info = get_node("/root/UserValues")
|
2022-08-08 06:42:26 +00:00
|
|
|
onready var main_screen = get_node("/root/main_screen")
|
|
|
|
onready var start_menu = get_node("/root/main_screen/start_menu")
|
|
|
|
onready var user_menu = get_node("/root/main_screen/user_details")
|
2022-08-03 01:01:10 +00:00
|
|
|
|
|
|
|
# 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
|
|
|
|
|
|
|
|
|
|
|
|
func _on_button_user_save_pressed():
|
|
|
|
|
|
|
|
# Store some values.
|
2022-08-08 09:16:19 +00:00
|
|
|
# Maybe this one only runs if there is no ini
|
2022-08-08 06:42:26 +00:00
|
|
|
config.set_value("User", "user_name", user_name.text)
|
|
|
|
user_info.user_first_name = user_name.text
|
|
|
|
#config.set_value("Player1", "best_score", 10)
|
|
|
|
#onfig.set_value("Player2", "player_name", "V3geta")
|
|
|
|
#config.set_value("Player2", "best_score", 9001)
|
2022-08-03 01:01:10 +00:00
|
|
|
|
|
|
|
# Save it to a file (overwrite if already exists).
|
2022-08-08 09:16:19 +00:00
|
|
|
# Need to make sure I never lose any values I add.
|
|
|
|
# This seems to be a manual thing to program.
|
|
|
|
# So per value, make sure to read it upon load.
|
|
|
|
# And write it out again as well.
|
|
|
|
|
2022-08-03 01:01:10 +00:00
|
|
|
config.save("user://user.ini")
|
2022-08-08 06:42:26 +00:00
|
|
|
|
|
|
|
main_screen.visible = true
|
|
|
|
start_menu.visible = true
|
|
|
|
user_menu.visible = false
|
2022-08-08 09:16:19 +00:00
|
|
|
|
|
|
|
# Need to do a "This thing can't be empty" code
|
|
|
|
# Most likely here. A if .text = null, then,
|
|
|
|
# don't proceed.
|