-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGDDlg_Settings.gd
51 lines (44 loc) · 1.3 KB
/
GDDlg_Settings.gd
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
49
50
51
# Copyright (c) 2019-2020 ZCaliptium.
extends Object
const PREFIX = "PluginSettings/gddlg/"
const PROP_PATHS = PREFIX + "DialogJsonPaths";
const PROP_LOADONREADY = PREFIX + "LoadOnReady";
const PROP_STRICTDIALOGATTRIBUTES = PREFIX + "StrictDialogAttributes";
const PROP_STRICTOPTIONATTRIBUTES = PREFIX + "StrictOptionAttributes";
const PROPERTIES: Array = [
{
"name": PROP_PATHS,
"type": TYPE_STRING_ARRAY,
"hint": PROPERTY_HINT_DIR
},
{
"name": PROP_LOADONREADY,
"type": TYPE_BOOL
},
{
"name": PROP_STRICTDIALOGATTRIBUTES,
"type": TYPE_BOOL
},
{
"name": PROP_STRICTOPTIONATTRIBUTES,
"type": TYPE_BOOL
}
];
const DEFAULTS: Dictionary = {
PROP_PATHS: {},
PROP_LOADONREADY: true,
PROP_STRICTDIALOGATTRIBUTES: false,
PROP_STRICTOPTIONATTRIBUTES: false
};
# Loads settings related to this plugin.
static func load_settings() -> void:
for i in range(0, PROPERTIES.size()):
var property_info: Dictionary = PROPERTIES[i];
set_default(property_info["name"], DEFAULTS.get(property_info["name"]));
ProjectSettings.add_property_info(property_info);
static func get_option(name: String):
return ProjectSettings.get(name);
# Sets project property if not exists.
static func set_default(name: String, value) -> void:
if (!ProjectSettings.has_setting(name)):
ProjectSettings.set(name, value);