50 lines
1.6 KiB
GDScript
50 lines
1.6 KiB
GDScript
class_name MenuSetting extends Resource
|
|
|
|
enum Receivers {
|
|
NONE,
|
|
NODEPATH,
|
|
SINGLETON,
|
|
AUDIO_SERVER,
|
|
CAMERA_SERVER,
|
|
DISPLAY_SERVER,
|
|
ENGINE,
|
|
IP_SETTINGS,
|
|
INPUT,
|
|
INPUT_MAP,
|
|
PHYSICS_2D,
|
|
PHYSICS_3D,
|
|
RENDERING_SERVER,
|
|
THEME_DB,
|
|
XR_SERVER
|
|
}
|
|
|
|
## The path to the Project Setting you are using. If it is a setting specific to your game, add it trough code or the Project Settings Panel.
|
|
@export_placeholder("i.e. application/config/name") var project_settings_path: String = ""
|
|
## Choose what gets changed in game when setting this value. None means the setting is ony meant to be applied after a reboot.
|
|
@export var change: Receivers = Receivers.NODEPATH:
|
|
set(value):
|
|
change = value
|
|
property_list_changed.emit()
|
|
## If you choose to change a custom node path, you can set it here.
|
|
@export_node_path() var nodepath: NodePath
|
|
## If you choose to change a singleton, you can set it's name here.
|
|
@export var singleton_name: StringName
|
|
## Path to the function you are setting.
|
|
@export_placeholder("\"set\" to change property") var attribute_path: String = ""
|
|
## extra attributes your call may need. Leave empty slot if variable is not meant to be at first index.
|
|
@export var extra_attributes: Array
|
|
|
|
func _validate_property(property: Dictionary) -> void:
|
|
if property.name == "nodepath" and change != Receivers.NODEPATH:
|
|
property.usage |= PROPERTY_USAGE_READ_ONLY
|
|
|
|
func get_connected_control() -> Control:
|
|
return Label.new()
|
|
|
|
func get_unonnected_control() -> Control:
|
|
var setting: Dictionary = ProjectSettings.get_setting_with_override(project_settings_path)
|
|
|
|
|
|
|
|
return Label.new()
|