diff options
author | Fredia Huya-Kouadio <fhuya@meta.com> | 2023-07-05 12:06:39 -0700 |
---|---|---|
committer | Fredia Huya-Kouadio <fhuya@meta.com> | 2023-07-05 12:10:05 -0700 |
commit | 93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32 (patch) | |
tree | effa5bd70925039ed7f6d4cbc56d5485e6e9a740 /hello_signals/demo/addons/hello_signals_plugin/interface | |
parent | 01f6b286390e552cd326df00ad16c65e5f5c703b (diff) | |
download | godot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.tar.gz godot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.tar.bz2 godot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.zip |
Update the directory structure for the Android plugin addon
The addon directory now contains two subfolders:
- "addons/<plugin_dir>/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/<plugin_dir>/interface":
- optional directory
- can contain helper gdscript files used by the project to interface with the functionality exposed by the plugin
Diffstat (limited to 'hello_signals/demo/addons/hello_signals_plugin/interface')
-rw-r--r-- | hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd | 27 |
1 files changed, 27 insertions, 0 deletions
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") |