wellbeingapp/godot/start_menu.gd

32 lines
1.2 KiB
GDScript3
Raw Normal View History

extends CanvasLayer
2022-07-31 05:27:58 +00:00
onready var user_values = get_node("/root/UserValues")
onready var program_values = get_node("/root/ProgramValues")
2022-07-31 05:27:58 +00:00
2022-07-31 05:27:58 +00:00
func _ready():
$version_label.text = str(program_values.current_version)
$welcome_title.text = "Good morning, " + user_values.user_first_name + "!"
2022-08-08 08:53:39 +00:00
2022-07-31 05:27:58 +00:00
#func _process(_delta):
# Currently the only working way to show the user name. NOT desirable, continuously running the same line of code for no reason than me not figuring it out.
# $welcome_title.text = "Good morning, " + user_info.user_first_name + "!"
2022-08-08 08:53:39 +00:00
func _on_button_update_check_pressed():
$HTTPRequest.request("https://raw.githubusercontent.com/hobbesjaap/wellbeingapp/main/version_info.csv")
2022-08-08 08:53:39 +00:00
func update_user_name_label():
$welcome_title.text = "Good morning, " + user_values.user_first_name + "!"
2022-08-08 08:53:39 +00:00
func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body):
2022-08-08 08:53:39 +00:00
var json = JSON.parse(body.get_string_from_utf8())
program_values.web_release_version = json.result
if program_values.web_release_version > program_values.release_version:
2022-08-08 08:55:30 +00:00
print("There's an update!")
elif program_values.web_release_version == program_values.release_version:
print("There is no update!")