Big refactor: Fix plugin issues when disabling/reenabling plugins (#598)
Co-authored-by: balloonpopper <5151242+balloonpopper@users.noreply.github.com> Co-authored-by: Duncan Brown <duncan@prometheussoftware.ca>
This commit is contained in:
@@ -70,7 +70,7 @@ var _is_gamepad_connected = false
|
||||
func _enter_tree():
|
||||
var room_selector_parent = $CanvasLayer/ui/HBoxContainer/VBoxContainer
|
||||
|
||||
if escoria.project_settings_manager.get_setting(escoria.project_settings_manager.ENABLE_ROOM_SELECTOR) \
|
||||
if ESCProjectSettingsManager.get_setting(ESCProjectSettingsManager.ENABLE_ROOM_SELECTOR) \
|
||||
and room_selector_parent.get_node_or_null("room_select") == null:
|
||||
|
||||
room_selector_parent.add_child(
|
||||
@@ -97,7 +97,7 @@ func _exit_tree():
|
||||
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if escoria.is_ready_for_inputs():
|
||||
if escoria.get_escoria().is_ready_for_inputs():
|
||||
if event is InputEventMouseMotion:
|
||||
escoria.main.current_scene.game. \
|
||||
update_tooltip_following_mouse_position(event.position)
|
||||
@@ -328,8 +328,9 @@ func pause_game():
|
||||
func apply_custom_settings(custom_settings: Dictionary):
|
||||
if custom_settings.has("a_custom_setting"):
|
||||
escoria.logger.info(
|
||||
"custom setting value loaded:",
|
||||
[custom_settings["a_custom_setting"]]
|
||||
self,
|
||||
"custom setting value loaded: %s."
|
||||
% str(custom_settings["a_custom_setting"])
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -3,16 +3,23 @@ tool
|
||||
extends EditorPlugin
|
||||
|
||||
|
||||
# Register UI
|
||||
func _enter_tree():
|
||||
call_deferred("_register")
|
||||
# Override function to return the plugin name.
|
||||
func get_plugin_name():
|
||||
return "escoria-ui-simplemouse"
|
||||
|
||||
|
||||
# Deregister UI
|
||||
func _exit_tree() -> void:
|
||||
escoria.deregister_ui("res://addons/escoria-ui-simplemouse/game.tscn")
|
||||
func disable_plugin():
|
||||
print("Disabling plugin Escoria UI Simple Mouse.")
|
||||
EscoriaPlugin.deregister_ui("res://addons/escoria-ui-simplemouse/game.tscn")
|
||||
|
||||
|
||||
# Register UI with Escoria
|
||||
func _register():
|
||||
escoria.register_ui("res://addons/escoria-ui-simplemouse/game.tscn")
|
||||
func enable_plugin():
|
||||
print("Enabling plugin Escoria UI Simple Mouse.")
|
||||
if not EscoriaPlugin.register_ui(self, "res://addons/escoria-ui-simplemouse/game.tscn"):
|
||||
get_editor_interface().set_plugin_enabled(
|
||||
get_plugin_name(),
|
||||
false
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user