-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.gd
More file actions
48 lines (33 loc) · 1.7 KB
/
main.gd
File metadata and controls
48 lines (33 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
tool
extends EditorPlugin
func _enter_tree():
add_autoload_singleton("GameJoltAPI", "res://addons/GameJoltAPI/API.gd")
#Adding all project settings
add_custom_project_setting("GameJoltAPI/Game/GameID", "", TYPE_STRING)
add_custom_project_setting("GameJoltAPI/Game/PrivateKey", "", TYPE_STRING)
add_custom_project_setting("GameJoltAPI/Requests/Multithread", false, TYPE_BOOL)
add_custom_project_setting("GameJoltAPI/Requests/DownloadPath", "user://GameJoltAPI/Downloads", TYPE_STRING)
add_custom_project_setting("GameJoltAPI/Debug/Verbose", false, TYPE_BOOL)
#Saving settings
var error := ProjectSettings.save()
if error: push_error("Encountered error %d when saving project settings." % error)
func add_custom_project_setting(name: String, value, type: int, hint: int = PROPERTY_HINT_NONE, hint_string: String = "") -> void:
#Add a setting to Project Settings
if ProjectSettings.has_setting(name): return
ProjectSettings.clear(name)
var setting_info: Dictionary = {
"name" : name,
"type" : type,
"hint" : hint,
"hint_string" : hint_string
}
ProjectSettings.set_setting(name, value)
ProjectSettings.add_property_info(setting_info)
func _exit_tree():
#Clear all Project Settings
ProjectSettings.clear("GameJoltAPI/Game/GameID")
ProjectSettings.clear("GameJoltAPI/Game/PrivateKey")
ProjectSettings.clear("GameJoltAPI/Requests/Multithread")
ProjectSettings.clear("GameJoltAPI/Requests/DownloadPath")
ProjectSettings.clear("GameJoltAPI/Debug/Verbose")
remove_autoload_singleton("GameJoltAPI")