From e6ede262236bae102d1afd8bc7638b8d0e56192a Mon Sep 17 00:00:00 2001 From: Jaap Marsman Date: Sun, 6 Nov 2022 19:57:49 +0800 Subject: [PATCH] Continuing work on updater info --- godot/main_screen.gd | 14 +++++++++++--- godot/main_screen.tscn | 5 +++++ updater/update_text.md | 4 ++-- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/godot/main_screen.gd b/godot/main_screen.gd index 7e5dab8..ff0b13a 100644 --- a/godot/main_screen.gd +++ b/godot/main_screen.gd @@ -7,6 +7,8 @@ var check_time_var : int var ddmmyyyy : String var date var csv_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/main/version_info.csv" +var update_text_url = "https://raw.githubusercontent.com/hobbesjaap/time-sampling-form/main/updater/update_text.md" +var update_text : String onready var date_time_display = $"%CurrentTime" onready var global_ints = $"/root/GlobalInts" @@ -19,6 +21,7 @@ func check_for_updates(): if os_check == "X11" and "Windows" and "OSX": print("We're on desktop. So let's check for updates!") $"%HTTPRequest".request(csv_url) + $"%HTTPRequest2".request(update_text_url) func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body): var json = JSON.parse(body.get_string_from_utf8()) @@ -26,9 +29,14 @@ func _on_HTTPRequest_request_completed(_result, _response_code, _headers, body): if global_ints.web_release_version > global_ints.release_version: print("There's an update!") $"%UpdatePanel".visible = true - -# elif global_ints.web_release_version == global_ints.release_version: -# print("There is no update!") + $"%UpdateText".text = str(update_text) + + +func _on_HTTPRequest2_request_completed(_result, _response_code, _headers, body): + var json = JSON.parse(body.get_string_from_utf8()) + update_text = str(json.result) + + func refresh_descriptors(): $"%1Acronym".text = global_ints.one_acronym diff --git a/godot/main_screen.tscn b/godot/main_screen.tscn index f26694c..2639076 100644 --- a/godot/main_screen.tscn +++ b/godot/main_screen.tscn @@ -69,6 +69,9 @@ __meta__ = { [node name="HTTPRequest" type="HTTPRequest" parent="."] unique_name_in_owner = true +[node name="HTTPRequest2" type="HTTPRequest" parent="."] +unique_name_in_owner = true + [node name="ClassroomPhoto" type="Sprite" parent="."] position = Vector2( 639.9, 201.694 ) scale = Vector2( 0.665729, 0.665729 ) @@ -638,6 +641,7 @@ text = "You are currently using version XX. The latest version available is XX. autowrap = true [node name="UpdateText" type="Label" parent="StartScreen/UpdatePanel"] +unique_name_in_owner = true margin_left = 33.0 margin_top = 146.0 margin_right = 1249.0 @@ -1269,6 +1273,7 @@ custom_fonts/font = SubResource( 12 ) text = "Item5" [connection signal="request_completed" from="HTTPRequest" to="." method="_on_HTTPRequest_request_completed"] +[connection signal="request_completed" from="HTTPRequest2" to="." method="_on_HTTPRequest2_request_completed"] [connection signal="button_down" from="StartScreen/InstructionPanel/MinuteBox/MinuteMinus" to="." method="_on_MinuteMinus_button_down"] [connection signal="pressed" from="StartScreen/InstructionPanel/MinuteBox/MinuteMinus" to="." method="_on_MinuteMinus_pressed"] [connection signal="pressed" from="StartScreen/InstructionPanel/MinuteBox/MinutePlus" to="." method="_on_MinutePlus_pressed"] diff --git a/updater/update_text.md b/updater/update_text.md index 7420736..dc79130 100644 --- a/updater/update_text.md +++ b/updater/update_text.md @@ -1,5 +1,5 @@ -This text is just a placeholder. +"This text is just a placeholder. - But I want to test if it works. - Like this. -- Or this. \ No newline at end of file +- Or this." \ No newline at end of file