-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgame_configuration.gd
47 lines (36 loc) · 1.31 KB
/
game_configuration.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
class_name GameConfiguration
extends Resource
const EXPORT_GROUP_GAME_SETTINGS = "Game Settings"
const EXPORT_GROUP_BUILD_SETTINGS = "Build Settings"
const EXPORT_GROUP_DEV_SETTINGS = "DEV Settings"
# @export_group(EXPORT_GROUP_GAME_SETTINGS)
@export_group(EXPORT_GROUP_BUILD_SETTINGS)
# TODO: append type of build
# TODO: create buildtype enum
var version: String
@export_group(EXPORT_GROUP_DEV_SETTINGS)
@export var quick_skip_main_screen: bool
@export var quick_exit_game: bool
func _init():
version = ProjectSettings.get_setting("application/config/version")
print("Version %s, is_release_build? %s" % [version, is_release_build()])
func is_release_build() -> bool:
return !OS.is_debug_build()
func setup():
_prepare_configuration()
func _prepare_configuration():
if is_release_build():
_disable_dev_setting_properties()
func _disable_dev_setting_properties():
var props = get_property_list()
var dev_settings_group_started := false
for prop in props:
if prop.usage & PROPERTY_USAGE_GROUP and prop.name == EXPORT_GROUP_DEV_SETTINGS:
dev_settings_group_started = true
continue
if dev_settings_group_started and prop.usage & PROPERTY_USAGE_GROUP:
# another group found, stop disabling properties
dev_settings_group_started = false
break
if dev_settings_group_started:
set(prop.name, false)