wellbeingapp/godot/main_screen.gd

43 lines
1.1 KiB
GDScript3
Raw Normal View History

2022-08-03 01:01:10 +00:00
extends Node2D
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-08 06:42:26 +00:00
onready var user_name = get_node("%textbox_user_name")
onready var user_info = get_node("/root/UserValues")
onready var program_info = get_node("/root/ProgramValues")
var config = ConfigFile.new()
var err = config.load("user://user.ini")
2022-08-03 01:01:10 +00:00
func _ready():
2022-08-08 06:42:26 +00:00
# Read config file if it exists
# otherwise set up new user data
if err != OK:
start_menu.visible = false
user_menu.visible = true
else:
2022-08-03 01:01:10 +00:00
# Set starting state visibility
2022-08-08 06:42:26 +00:00
main_screen.visible = true
start_menu.visible = true
user_menu.visible = false
# define variables from ini file
user_info.user_first_name = config.get_value("User", "user_name")
user_name.text = user_info.user_first_name
# Iterate over all sections.
# for player in config.get_sections():
# # Fetch the data for each section.
# var player_name = config.get_value(player, "player_name")
# var player_score = config.get_value(player, "best_score")
2022-08-03 01:01:10 +00:00
#func _process(delta):
# pass