summaryrefslogtreecommitdiff
path: root/plugins/hello_signals/src
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuya@meta.com>2023-08-17 14:37:44 -0700
committerFredia Huya-Kouadio <fhuya@meta.com>2023-08-17 14:37:44 -0700
commitc734dd980de4bcd2351ef80a4956646506402ab1 (patch)
tree44c106860be98efa7bd2d77ab8bd2baa632867ff /plugins/hello_signals/src
parentf42745b1d88e7ad563f1fd9668c04ed8b261189b (diff)
downloadgodot-android-samples-c734dd980de4bcd2351ef80a4956646506402ab1.tar.gz
godot-android-samples-c734dd980de4bcd2351ef80a4956646506402ab1.tar.bz2
godot-android-samples-c734dd980de4bcd2351ef80a4956646506402ab1.zip
Update the 'Hello Signals' plugin sample to match updates to the addon's folder structure
Diffstat (limited to 'plugins/hello_signals/src')
-rw-r--r--plugins/hello_signals/src/main/AndroidManifest.xml7
-rw-r--r--plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gdignore1
-rw-r--r--plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.bin/.gitignore3
-rw-r--r--plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/.gdignore1
-rw-r--r--plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_export_plugin.gd16
-rw-r--r--plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/.export/hello_signals_editor_plugin.gd16
-rw-r--r--plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/interface/hello_signals_plugin.gd27
-rw-r--r--plugins/hello_signals/src/main/assets/addons/hello_signals_plugin/plugin.cfg7
8 files changed, 74 insertions, 4 deletions
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 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="fhuyakou.godot.plugin.android.hellosignals">
+<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<!--
Plugin metadata:
- - In the `android:name` attribute, the `org.godotengine.plugin.v1` prefix
+ - In the `android:name` attribute, the `org.godotengine.plugin.v2` prefix
is required so Godot can recognize the project as a valid Godot
Android plugin. The plugin name following the prefix should match the value
of the plugin name returned by the plugin initializer.
@@ -14,7 +13,7 @@
initializer.
-->
<meta-data
- android:name="org.godotengine.plugin.v1.HelloSignals"
+ android:name="org.godotengine.plugin.v2.HelloSignals"
android:value="fhuyakou.godot.plugin.android.hellosignals.HelloSignalsPlugin" />
</application>
</manifest>
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"