From 93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Wed, 5 Jul 2023 12:06:39 -0700 Subject: Update the directory structure for the Android plugin addon The addon directory now contains two subfolders: - "addons//export": - should contain the editor plugin script and the editor export plugin script. as well as any binaries needed for export - `plugin.cfg` must point to the editor plugin script in this directory - must contain a `.gdignore` file to exclude this directory from the export process - "addons//interface": - optional directory - can contain helper gdscript files used by the project to interface with the functionality exposed by the plugin --- .../interface/hello_signals_plugin.gd | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd (limited to 'hello_signals/demo/addons/hello_signals_plugin/interface') diff --git a/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd b/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd new file mode 100644 index 0000000..0cc9c1d --- /dev/null +++ b/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd @@ -0,0 +1,27 @@ +class_name HelloSignalsPlugin extends Object + +## Interface used to access the functionality provided by the HelloSignals plugin + +var _hello_signals_singleton + +func _init(): + if Engine.has_singleton("HelloSignals"): + _hello_signals_singleton = Engine.get_singleton("HelloSignals") + else: + printerr("Couldn't find HelloSignals singleton") + + +## Register for the tiktok signals emitted +func registerForTikTok(callback: Callable) -> void: + if _hello_signals_singleton: + _hello_signals_singleton.connect("TikTok", callback) + else: + printerr("Unable to register for tiktok") + + +## Start tiktok if not started, otherwise stop it +func toggleTikTok(): + if _hello_signals_singleton: + _hello_signals_singleton.onButtonPressed() + else: + printerr("Unable to toggle tiktok") -- cgit v1.2.3