@@ -6,11 +6,13 @@ var extension_container :VBoxContainer
66var extension_path : String = ""
77
88## ## Usage:
9- ## # Change the "store_link" and "download_file" variables to your choice
9+ ## # Change the "store_version", " store_link" and "download_file" variables to your choice
1010## # Don't touch anything else
1111var download_file : String = "variable_info.txt" # File can be of any name you want
1212var store_link : String = "https://raw.githubusercontent.com/Variable-ind/Pixelorama-Extensions/master/store_info.txt"
13+ var store_version : float = 0.1
1314
15+ var new_version_available := false
1416## # Principle/Setup:
1517# 1) Make a file in the repository and store all the extensions inside it in
1618# the form of
@@ -42,7 +44,11 @@ func _on_StoreButton_pressed() -> void:
4244
4345
4446func _on_Store_about_to_show () -> void :
45- # clear old entries
47+ # Display Version
48+ if ! window_title .ends_with (str (" (" , store_version , ")" )):
49+ window_title += str (" (" , store_version , ")" )
50+
51+ # Clear old entries
4652 for entry in content .get_children ():
4753 entry .queue_free ()
4854
@@ -65,13 +71,27 @@ func _on_HTTPRequest_request_completed(result: int, _response_code: int, _header
6571 if result == HTTPRequest .RESULT_SUCCESS :
6672 var file = File .new ()
6773 var _error = file .open (str (extension_path ,download_file ), File .READ )
74+ var version :float
6875
69- var dummy_number = 0 # I don't need the first line of file
76+ var dummy_number = 1
7077 while not file .eof_reached ():
7178 var info = str2var (file .get_line ())
72- if dummy_number > 0 :
73- if typeof (info ) == TYPE_ARRAY :
74- add_entry (info )
79+ if typeof (info ) == TYPE_REAL :
80+ # check version
81+ version = info
82+ if version > store_version :
83+ new_version_available = true
84+ elif typeof (info ) == TYPE_ARRAY :
85+ if dummy_number >= 3 :
86+ if new_version_available :
87+ if dummy_number == 3 :
88+ var label := Label .new ()
89+ label .text = str ("Version " , version , " is Available" )
90+ content .add_child (label )
91+ add_entry (info ) # Announce update
92+ else :
93+ if dummy_number > 3 : # The first 3 lines of file are Store-related and are excluded
94+ add_entry (info )
7595 dummy_number += 1
7696 file .close ()
7797 var dir := Directory .new ()
0 commit comments