summaryrefslogtreecommitdiff
path: root/hello_signals/demo/Main.gd
diff options
context:
space:
mode:
authorFredia Huya-Kouadio <fhuya@meta.com>2023-07-05 12:06:39 -0700
committerFredia Huya-Kouadio <fhuya@meta.com>2023-07-05 12:10:05 -0700
commit93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32 (patch)
treeeffa5bd70925039ed7f6d4cbc56d5485e6e9a740 /hello_signals/demo/Main.gd
parent01f6b286390e552cd326df00ad16c65e5f5c703b (diff)
downloadgodot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.tar.gz
godot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.tar.bz2
godot-android-samples-93543c9cc7b9b7b3526fd3eb2a0f6819cc6fee32.zip
Update the directory structure for the Android plugin addon
The addon directory now contains two subfolders: - "addons/<plugin_dir>/export": - should contain the editor plugin script and the editor export plugin script. as well as any binaries needed for export - `plugin.cfg` must point to the editor plugin script in this directory - must contain a `.gdignore` file to exclude this directory from the export process - "addons/<plugin_dir>/interface": - optional directory - can contain helper gdscript files used by the project to interface with the functionality exposed by the plugin
Diffstat (limited to 'hello_signals/demo/Main.gd')
-rw-r--r--hello_signals/demo/Main.gd14
1 files changed, 6 insertions, 8 deletions
diff --git a/hello_signals/demo/Main.gd b/hello_signals/demo/Main.gd
index 1b3e972..2dca0db 100644
--- a/hello_signals/demo/Main.gd
+++ b/hello_signals/demo/Main.gd
@@ -2,16 +2,13 @@ extends Node2D
var timerCount = 0
var timerRunning = false
-var helloSignals
+var helloSignalsPlugin : HelloSignalsPlugin
func _ready():
- if Engine.has_singleton("HelloSignals"):
- helloSignals = Engine.get_singleton("HelloSignals")
- helloSignals.connect("TikTok", Callable(self, "_on_tiktok"))
+ helloSignalsPlugin = preload("res://addons/hello_signals_plugin/interface/hello_signals_plugin.gd").new()
+ helloSignalsPlugin.registerForTikTok(Callable(self, "_on_tiktok"))
- $Button.connect("pressed", Callable(self, "_on_Button_pressed"))
- else:
- print("Couldn't find HelloSignals singleton")
+ $Button.connect("pressed", Callable(self, "_on_Button_pressed"))
func _on_tiktok():
@@ -19,9 +16,10 @@ func _on_tiktok():
timerCount = timerCount + 1
$Label.text = str(timerCount)
+
func _on_Button_pressed():
print("on button pressed from GDScript")
- helloSignals.onButtonPressed()
+ helloSignalsPlugin.toggleTikTok()
timerRunning = !timerRunning
if (timerRunning):
$Button.text = "Stop Timer"