minor changes in getting everything working in Godot 4

This commit is contained in:
Jaap Marsman 2023-05-14 16:36:23 +08:00
parent 5675f17841
commit 58ef1c4f05
4 changed files with 68 additions and 26 deletions

View File

@ -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():

View File

@ -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!")

View File

@ -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"]

View File

@ -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