GodotProjects/Sprout/addons/dialogic/Editor/dialogic_editor.gd
2023-01-03 16:54:53 -07:00

47 lines
1.1 KiB
GDScript

@tool
class_name DialogicEditor
extends Control
## Base class for all dialogic editors.
# These signals will automatically be emitted if current_resource_state is changed.
signal resource_saved()
signal resource_unsaved()
var current_resource: Resource
## State of the current resource
enum ResourceStates {Saved, Unsaved}
var current_resource_state: ResourceStates:
set(value):
current_resource_state = value
if value == ResourceStates.Saved:
resource_saved.emit()
else:
resource_unsaved.emit()
var editors_manager: Control
## Overwrite. Register to the editor manager in here.
func _register() -> void:
pass
## If this editor supports editing resources, load them here (overwrite in subclass)
func _open_resource(resource:Resource) -> void:
pass
## If this editor supports editing resources, save them here (overwrite in subclass)
func _save_resource() -> void:
pass
## Overwrite. Called when this editor is shown. (show() doesn't have to be called)
func _open(extra_info:Variant = null) -> void:
pass
## Overwrite. Called when another editor is opened. (hide() doesn't have to be called)
func _close():
pass