summaryrefslogtreecommitdiff
path: root/plugins/hello_signals/demo
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/hello_signals/demo')
-rw-r--r--plugins/hello_signals/demo/addons/.gitignore2
-rw-r--r--plugins/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd33
-rw-r--r--plugins/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin_interface.gd27
-rw-r--r--plugins/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg7
4 files changed, 68 insertions, 1 deletions
diff --git a/plugins/hello_signals/demo/addons/.gitignore b/plugins/hello_signals/demo/addons/.gitignore
index d6b7ef3..f448769 100644
--- a/plugins/hello_signals/demo/addons/.gitignore
+++ b/plugins/hello_signals/demo/addons/.gitignore
@@ -1,2 +1,2 @@
-*
+bin
!.gitignore
diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd b/plugins/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd
new file mode 100644
index 0000000..6145d44
--- /dev/null
+++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/hello_signals_export_plugin.gd
@@ -0,0 +1,33 @@
+@tool
+extends EditorPlugin
+
+# A class member to hold the export plugin during its lifecycle
+var export_plugin : AndroidExportPlugin
+
+func _enter_tree():
+ # Initialization of the plugin goes here.
+ export_plugin = AndroidExportPlugin.new()
+ add_export_plugin(export_plugin)
+
+
+func _exit_tree():
+ # Clean-up of the plugin goes here.
+ remove_export_plugin(export_plugin)
+ export_plugin = null
+
+
+class AndroidExportPlugin extends EditorExportPlugin:
+
+ func _supports_platform(platform):
+ if platform is EditorExportPlatformAndroid:
+ return true
+ return false
+
+ func _get_android_libraries(platform, debug):
+ if debug:
+ return PackedStringArray(["hello_signals_plugin/bin/debug/HelloSignals.debug.aar"])
+ else:
+ return PackedStringArray(["hello_signals_plugin/bin/release/HelloSignals.release.aar"])
+
+ func _get_name():
+ return "Hello Signals plugin"
diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin_interface.gd b/plugins/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin_interface.gd
new file mode 100644
index 0000000..0cc9c1d
--- /dev/null
+++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/hello_signals_plugin_interface.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")
diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg b/plugins/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg
new file mode 100644
index 0000000..4ffab22
--- /dev/null
+++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/plugin.cfg
@@ -0,0 +1,7 @@
+[plugin]
+
+name="Hello Signals plugin"
+description="Showcases how to package a sample Android plugin"
+author="Fredia Huya-Kouadio"
+version=""
+script="hello_signals_export_plugin.gd"