From c734dd980de4bcd2351ef80a4956646506402ab1 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Thu, 17 Aug 2023 14:37:44 -0700 Subject: Update the 'Hello Signals' plugin sample to match updates to the addon's folder structure --- plugins/hello_signals/src/main/AndroidManifest.xml | 7 +++--- .../addons/hello_signals_plugin/.bin/.gdignore | 1 + .../addons/hello_signals_plugin/.bin/.gitignore | 3 +++ .../addons/hello_signals_plugin/.export/.gdignore | 1 + .../.export/hello_signals_editor_export_plugin.gd | 16 +++++++++++++ .../.export/hello_signals_editor_plugin.gd | 16 +++++++++++++ .../interface/hello_signals_plugin.gd | 27 ++++++++++++++++++++++ .../assets/addons/hello_signals_plugin/plugin.cfg | 7 ++++++ 8 files changed, 74 insertions(+), 4 deletions(-) create mode 100644 plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gdignore create mode 100644 plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gitignore create mode 100644 plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/.gdignore create mode 100644 plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_export_plugin.gd create mode 100644 plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_plugin.gd create mode 100644 plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/interface/hello_signals_plugin.gd create mode 100644 plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/plugin.cfg (limited to 'plugins/hello_signals/src') diff --git a/plugins/hello_signals/src/main/AndroidManifest.xml b/plugins/hello_signals/src/main/AndroidManifest.xml index 8f791bd..45f0e71 100644 --- a/plugins/hello_signals/src/main/AndroidManifest.xml +++ b/plugins/hello_signals/src/main/AndroidManifest.xml @@ -1,11 +1,10 @@ - + diff --git a/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gdignore b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gdignore @@ -0,0 +1 @@ + diff --git a/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gitignore b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gitignore new file mode 100644 index 0000000..375ed0d --- /dev/null +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gitignore @@ -0,0 +1,3 @@ +* +!.gitignore +!.gdignore diff --git a/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/.gdignore b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/.gdignore @@ -0,0 +1 @@ + diff --git a/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_export_plugin.gd b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_export_plugin.gd new file mode 100644 index 0000000..ca0bcf4 --- /dev/null +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_export_plugin.gd @@ -0,0 +1,16 @@ +@tool +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/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_plugin.gd b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_plugin.gd new file mode 100644 index 0000000..5df34a9 --- /dev/null +++ b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_plugin.gd @@ -0,0 +1,16 @@ +@tool +extends EditorPlugin + +# A class member to hold the export plugin during its lifecycle +var export_plugin : EditorExportPlugin + +func _enter_tree(): + # Initialization of the plugin goes here. + export_plugin = preload("hello_signals_editor_export_plugin.gd").new() + add_export_plugin(export_plugin) + + +func _exit_tree(): + # Clean-up of the plugin goes here. + remove_export_plugin(export_plugin) + export_plugin = null diff --git a/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/interface/hello_signals_plugin.gd b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/interface/hello_signals_plugin.gd new file mode 100644 index 0000000..0cc9c1d --- /dev/null +++ b/plugins/hello_signals/src/main/assets/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") diff --git a/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/plugin.cfg b/plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/plugin.cfg new file mode 100644 index 0000000..ca4a695 --- /dev/null +++ b/plugins/hello_signals/src/main/assets/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=".export/hello_signals_editor_plugin.gd" -- cgit v1.2.3