summaryrefslogtreecommitdiff
path: root/hello_signals/demo/addons/hello_signals_plugin/interface
diff options
context:
space:
mode:
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.gd27
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")