From 58ef1c4f0523cf4b7fbe1bba78c4a68cdf6a3aeb Mon Sep 17 00:00:00 2001 From: Jaap Marsman Date: Sun, 14 May 2023 16:36:23 +0800 Subject: [PATCH] minor changes in getting everything working in Godot 4 --- godot/program_values.gd | 6 ++--- godot/start_menu.gd | 31 ++++++++---------------- godot/start_screen.tscn | 53 +++++++++++++++++++++++++++++++++++++++++ godot/user_values.gd | 4 ++-- 4 files changed, 68 insertions(+), 26 deletions(-) diff --git a/godot/program_values.gd b/godot/program_values.gd index ddd169f..1985990 100644 --- a/godot/program_values.gd +++ b/godot/program_values.gd @@ -4,14 +4,14 @@ extends Node # This variable lists the release number. # This is "the number of releases". -var release_version = 1 +var release_version : int = 1 # The var web_release_version is pulled from GitHub # when the update button is checked. A higher value means # an update is available -var web_release_version = 0 -var current_version = "0.0.8" +var web_release_version : int = 0 +var current_version : String = "0.0.8" func _ready(): diff --git a/godot/start_menu.gd b/godot/start_menu.gd index 0eb1542..9c08a4e 100644 --- a/godot/start_menu.gd +++ b/godot/start_menu.gd @@ -1,27 +1,16 @@ extends CanvasLayer +var csv_url : String = "https://raw.githubusercontent.com/hobbesjaap/wellbeingapp/main/version_info.csv" +var welcome_day_part : String = " " -@onready var user_values = get_node("/root/UserValues") -@onready var program_values = get_node("/root/ProgramValues") - -var csv_url = "https://raw.githubusercontent.com/hobbesjaap/wellbeingapp/main/version_info.csv" - -var welcome_day_part = " " func _ready(): - $version_label.text = "Version " + str(program_values.current_version) + $version_label.text = "Version " + str(ProgramValues.current_version) - user_values.get_device_time() - user_values.set_welcome_day_part() + UserValues.get_device_time() + UserValues.set_welcome_day_part() - $welcome_title.text = user_values.welcome_day_part + user_values.user_first_name + "!" - - - - - -#func _process(_delta): -# pass + $welcome_title.text = UserValues.welcome_day_part + UserValues.user_first_name + "!" func _on_button_update_check_pressed(): @@ -29,15 +18,15 @@ func _on_button_update_check_pressed(): func update_user_name_label(): - $welcome_title.text = "Good morning, " + user_values.user_first_name + "!" + $welcome_title.text = "Good morning, " + UserValues.user_first_name + "!" func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body): var test_json_conv = JSON.new() test_json_conv.parse(body.get_string_from_utf8()) var json = test_json_conv.get_data() - program_values.web_release_version = json.result - if program_values.web_release_version > program_values.release_version: + ProgramValues.web_release_version = json.result + if ProgramValues.web_release_version > ProgramValues.release_version: print("There's an update!") - elif program_values.web_release_version == program_values.release_version: + elif ProgramValues.web_release_version == ProgramValues.release_version: print("There is no update!") diff --git a/godot/start_screen.tscn b/godot/start_screen.tscn index e85201d..9cc6d0e 100644 --- a/godot/start_screen.tscn +++ b/godot/start_screen.tscn @@ -34,9 +34,57 @@ theme = ExtResource("5") [node name="start_menu" parent="UI/top_container" instance=ExtResource("3")] visible = false +[node name="welcome_title" parent="UI/top_container/start_menu" index="0"] +anchors_preset = 5 + +[node name="version_label" parent="UI/top_container/start_menu" index="2"] +anchors_preset = 2 + +[node name="button_daily_action" parent="UI/top_container/start_menu/GridContainer" index="0"] +layout_mode = 2 + +[node name="button_open_github" parent="UI/top_container/start_menu/GridContainer" index="1"] +layout_mode = 2 + +[node name="button_email_feedback" parent="UI/top_container/start_menu/GridContainer" index="2"] +layout_mode = 2 + +[node name="button_name" parent="UI/top_container/start_menu/GridContainer" index="3"] +layout_mode = 2 + +[node name="button_update_check" parent="UI/top_container/start_menu/GridContainer" index="4"] +layout_mode = 2 + +[node name="button_journal" parent="UI/top_container/start_menu/GridContainer" index="5"] +layout_mode = 2 + [node name="user_details" parent="UI/top_container" instance=ExtResource("2")] visible = false +[node name="user_menu" parent="UI/top_container/user_details" index="0"] +anchors_preset = 8 + +[node name="green_panel" parent="UI/top_container/user_details/user_menu" index="0"] +layout_mode = 2 + +[node name="label_first_time" parent="UI/top_container/user_details/user_menu/green_panel" index="0"] +layout_mode = 0 + +[node name="textbox_user_name" parent="UI/top_container/user_details/user_menu/green_panel" index="1"] +layout_mode = 0 + +[node name="birthday_selector" parent="UI/top_container/user_details/user_menu/green_panel" index="2"] +layout_mode = 0 + +[node name="button_birth_month" parent="UI/top_container/user_details/user_menu/green_panel/birthday_selector" index="0"] +layout_mode = 2 + +[node name="button_birth_day" parent="UI/top_container/user_details/user_menu/green_panel/birthday_selector" index="1"] +layout_mode = 2 + +[node name="button_user_save" parent="UI/top_container/user_details/user_menu/green_panel" index="3"] +layout_mode = 0 + [node name="daily_prompts" parent="UI/top_container" instance=ExtResource("4")] visible = false @@ -50,3 +98,8 @@ anchor_top = 1.0 anchor_right = 1.0 anchor_bottom = 1.0 offset_top = -40.0 + +[editable path="UI/top_container/start_menu"] +[editable path="UI/top_container/user_details"] +[editable path="UI/top_container/daily_prompts"] +[editable path="UI/top_container/pomodoro"] diff --git a/godot/user_values.gd b/godot/user_values.gd index cb964b2..55e60b5 100644 --- a/godot/user_values.gd +++ b/godot/user_values.gd @@ -30,8 +30,8 @@ var err = config.load("user://user.ini") # This function can be triggered to update the known system time. func get_device_time(): - date = OS.get_date() - date_time = OS.get_time() + date = Time.get_date_dict_from_system() + date_time = Time.get_time_dict_from_system() date_time_hour = date_time.hour date_month = date.month date_day = date.day