diff options
author | Fredia Huya-Kouadio <fhuya@meta.com> | 2023-07-14 13:46:24 -0700 |
---|---|---|
committer | Fredia Huya-Kouadio <fhuya@meta.com> | 2023-07-14 13:46:24 -0700 |
commit | b4844e98619766232645d70f80a29c2a53bc2709 (patch) | |
tree | 500a6deee2dfbd36f4356d69a2d5cb762314b03f /plugins/hello_signals/demo/addons/hello_signals_plugin | |
parent | 1d19d5912d1ac5bfa3cf6cc30f086aee8f0464f2 (diff) | |
download | godot-android-samples-b4844e98619766232645d70f80a29c2a53bc2709.tar.gz godot-android-samples-b4844e98619766232645d70f80a29c2a53bc2709.tar.bz2 godot-android-samples-b4844e98619766232645d70f80a29c2a53bc2709.zip |
Update the directory structure to make room for additional Godot Android samples besides plugins
Diffstat (limited to 'plugins/hello_signals/demo/addons/hello_signals_plugin')
7 files changed, 68 insertions, 0 deletions
diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/.gdignore @@ -0,0 +1 @@ + diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar Binary files differnew file mode 100644 index 0000000..d241ab1 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.debug.aar diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar Binary files differnew file mode 100644 index 0000000..6dae345 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/HelloSignals.release.aar diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_export_plugin.gd new file mode 100644 index 0000000..f0f3288 --- /dev/null +++ b/plugins/hello_signals/demo/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/export/HelloSignals.debug.aar"]) + else: + return PackedStringArray(["hello_signals_plugin/export/HelloSignals.release.aar"]) + +func _get_name(): + return "Hello Signals plugin" diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd new file mode 100644 index 0000000..5c71083 --- /dev/null +++ b/plugins/hello_signals/demo/addons/hello_signals_plugin/export/hello_signals_editor_plugin.gd @@ -0,0 +1,17 @@ +@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) + pass + + +func _exit_tree(): + # Clean-up of the plugin goes here. + remove_export_plugin(export_plugin) + export_plugin = null diff --git a/plugins/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd b/plugins/hello_signals/demo/addons/hello_signals_plugin/interface/hello_signals_plugin.gd new file mode 100644 index 0000000..0cc9c1d --- /dev/null +++ b/plugins/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") 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..b32555f --- /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="export/hello_signals_editor_plugin.gd" |