diff --git a/addons/talo/samples/playground/playground.tscn b/addons/talo/samples/playground/playground.tscn index 35787b6..590a4e4 100644 --- a/addons/talo/samples/playground/playground.tscn +++ b/addons/talo/samples/playground/playground.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=24 format=3 uid="uid://bg71kho7jirad"] +[gd_scene load_steps=25 format=3 uid="uid://bg71kho7jirad"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/identify_button.gd" id="1_o53s3"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/identified_state.gd" id="1_qsdrr"] @@ -15,6 +15,7 @@ [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/get_saves_button.gd" id="8_4usai"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/get_entries_button.gd" id="8_8262a"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/add_entry_button.gd" id="9_3705v"] +[ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/flush_events_button.gd" id="11_ocslk"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/create_save_button.gd" id="12_4prkt"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/loadable_color_rect.gd" id="12_72qp7"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/randomise_save_button.gd" id="12_sshwt"] @@ -143,6 +144,11 @@ layout_mode = 2 text = "Track event" script = ExtResource("4_vboi8") +[node name="FlushEventsButton" type="Button" parent="UI/Content/APIs/Events"] +layout_mode = 2 +text = "Flush events" +script = ExtResource("11_ocslk") + [node name="Live config" type="VBoxContainer" parent="UI/Content/APIs"] layout_mode = 2 theme_override_constants/separation = 20 @@ -471,6 +477,7 @@ script = ExtResource("19_2r4rn") [connection signal="pressed" from="UI/Content/APIs/Players_Continuity/Continuity/ToggleContinuityButton" to="UI/Content/APIs/Players_Continuity/Continuity/ToggleContinuityButton" method="_on_pressed"] [connection signal="pressed" from="UI/Content/APIs/Players_Continuity/Continuity/ToggleNetworkButton" to="UI/Content/APIs/Players_Continuity/Continuity/ToggleNetworkButton" method="_on_pressed"] [connection signal="pressed" from="UI/Content/APIs/Events/TrackEventButton" to="UI/Content/APIs/Events/TrackEventButton" method="_on_pressed"] +[connection signal="pressed" from="UI/Content/APIs/Events/FlushEventsButton" to="UI/Content/APIs/Events/FlushEventsButton" method="_on_pressed"] [connection signal="pressed" from="UI/Content/APIs/Live config/GetConfigButton" to="UI/Content/APIs/Live config/GetConfigButton" method="_on_pressed"] [connection signal="pressed" from="UI/Content/APIs/Stats/TrackStatButton" to="UI/Content/APIs/Stats/TrackStatButton" method="_on_pressed"] [connection signal="pressed" from="UI/Content/APIs/Leaderboards/GetEntriesButton" to="UI/Content/APIs/Leaderboards/GetEntriesButton" method="_on_pressed"] diff --git a/addons/talo/samples/playground/scripts/flush_events_button.gd b/addons/talo/samples/playground/scripts/flush_events_button.gd new file mode 100644 index 0000000..523202d --- /dev/null +++ b/addons/talo/samples/playground/scripts/flush_events_button.gd @@ -0,0 +1,9 @@ +extends Node + +func _on_pressed() -> void: + if Talo.identity_check() != OK: + %ResponseLabel.text = "You need to identify a player first!" + return + + await Talo.events.flush() + %ResponseLabel.text = "Events flushed" diff --git a/addons/talo/samples/playground/scripts/track_event_button.gd b/addons/talo/samples/playground/scripts/track_event_button.gd index c250055..f6b32fa 100644 --- a/addons/talo/samples/playground/scripts/track_event_button.gd +++ b/addons/talo/samples/playground/scripts/track_event_button.gd @@ -4,6 +4,7 @@ extends Button @export var event_props: Dictionary = { "prop1": "value1" } +@export var flush_immediately: bool func _on_pressed() -> void: if Talo.identity_check() != OK: @@ -15,4 +16,8 @@ func _on_pressed() -> void: return Talo.events.track(event_name, event_props) - %ResponseLabel.text = "Event queued: %s %s" % [event_name, event_props] + if flush_immediately: + await Talo.events.flush() + %ResponseLabel.text = "Event flushed: %s %s" % [event_name, event_props] + else: + %ResponseLabel.text = "Event queued: %s %s" % [event_name, event_props]