-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make playground more interactive, add better messaging
- Loading branch information
Showing
28 changed files
with
142 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,18 @@ | ||
extends Button | ||
|
||
@onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" | ||
@export var leaderboard_name: String | ||
|
||
func _on_pressed() -> void: | ||
if Talo.identity_check() != OK: | ||
%ResponseLabel.text = "You need to identify a player first!" | ||
return | ||
|
||
if leaderboard_name.is_empty(): | ||
%ResponseLabel.text = "leaderboard_name not set on AddEntryButton" | ||
return | ||
|
||
var score = RandomNumberGenerator.new().randi_range(1, 50) | ||
var res = await Talo.leaderboards.add_entry(leaderboard_name, score) | ||
|
||
if res.size() > 0: | ||
response_label.text = "Added score: %s, new high score: %s" % [score, res[1]] | ||
%ResponseLabel.text = "Added score: %s, new high score: %s" % [score, res[1]] |
7 changes: 0 additions & 7 deletions
7
addons/talo/samples/playground/scripts/delete_health_button.gd
This file was deleted.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
addons/talo/samples/playground/scripts/delete_prop_button.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
extends Button | ||
|
||
@export var prop_name: String | ||
|
||
func _on_pressed() -> void: | ||
if Talo.identity_check() != OK: | ||
%ResponseLabel.text = "You need to identify a player first!" | ||
return | ||
|
||
if prop_name.is_empty(): | ||
%ResponseLabel.text = "prop_name not set on DeletePropButton" | ||
return | ||
|
||
Talo.current_player.delete_prop(prop_name) |
6 changes: 0 additions & 6 deletions
6
addons/talo/samples/playground/scripts/discover_secret_button.gd
This file was deleted.
Oops, something went wrong.
6 changes: 2 additions & 4 deletions
6
addons/talo/samples/playground/scripts/get_categories_button.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,10 @@ | ||
extends Button | ||
|
||
@onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" | ||
|
||
func _on_pressed() -> void: | ||
var categories = await Talo.feedback.get_categories() | ||
|
||
if categories.size() == 0: | ||
response_label.text = "No categories found. Create some in the Talo dashboard!" | ||
%ResponseLabel.text = "No categories found. Create some in the Talo dashboard!" | ||
else: | ||
var mapped = categories.map(func (c): return "%s (%s)" % [c.display_name, c.internal_name]) | ||
response_label.text = "Categories: " + ", ".join(mapped) | ||
%ResponseLabel.text = "Categories: " + ", ".join(mapped) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
extends Button | ||
|
||
@onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" | ||
@export var leaderboard_name: String | ||
|
||
func _on_pressed() -> void: | ||
if leaderboard_name.is_empty(): | ||
%ResponseLabel.text = "leaderboard_name not set on GetEntriesButton" | ||
return | ||
|
||
var res = await Talo.leaderboards.get_entries(leaderboard_name, 0) | ||
|
||
if res.size() > 0: | ||
var entries = res[0] | ||
response_label.text = "Received %s entries" % entries.size() | ||
%ResponseLabel.text = "Received %s entries" % entries.size() | ||
else: | ||
%ResponseLabel.text = "No entries found for %s" % leaderboard_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
extends Button | ||
|
||
@onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" | ||
@export var group_id: String = "" | ||
@export var group_id: String | ||
|
||
func _on_pressed() -> void: | ||
if not group_id.is_empty(): | ||
var group = await Talo.player_groups.get_group(group_id) | ||
if group != null: | ||
response_label.text = "%s has %s player(s)" % [group.display_name, group.count] | ||
else: | ||
print_rich("[color=yellow]Group %s not found[/color]" % [group_id]) | ||
if group_id.is_empty(): | ||
%ResponseLabel.text = "group_id not set on GetGroupButton" | ||
return | ||
|
||
var group = await Talo.player_groups.get_group(group_id) | ||
if group != null: | ||
%ResponseLabel.text = "%s has %s player(s)" % [group.display_name, group.count] | ||
else: | ||
print_rich("[color=yellow]group_id not set on GetGroupButton[/color]") | ||
%ResponseLabel.text = "Group %s not found" % group_id |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
extends Button | ||
|
||
@export var service: String | ||
@export var service: String = "username" | ||
@export var identifier: String | ||
|
||
func _on_pressed(): | ||
if service.is_empty() or identifier.is_empty(): | ||
%ResponseLabel.text = "service or identifier not set on IdentifyButton" | ||
return | ||
|
||
Talo.players.identify(service, identifier) |
This file was deleted.
Oops, something went wrong.
16 changes: 11 additions & 5 deletions
16
addons/talo/samples/playground/scripts/send_feedback_button.gd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,16 @@ | ||
extends Button | ||
|
||
@export var internal_name: String | ||
@export var category_name: String | ||
@export var feedback_comment: String | ||
|
||
@onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" | ||
|
||
func _on_pressed() -> void: | ||
await Talo.feedback.send(internal_name, feedback_comment) | ||
response_label.text = "Feedback sent for %s: %s" % [internal_name, feedback_comment] | ||
if Talo.identity_check() != OK: | ||
%ResponseLabel.text = "You need to identify a player first!" | ||
return | ||
|
||
if category_name.is_empty() or feedback_comment.is_empty(): | ||
%ResponseLabel.text = "category_name or feedback_comment not set on SendFeedbackButton" | ||
return | ||
|
||
await Talo.feedback.send(category_name, feedback_comment) | ||
%ResponseLabel.text = "Feedback sent for %s: %s" % [category_name, feedback_comment] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
extends Button | ||
|
||
@export var prop_name: String | ||
@export var prop_value: String | ||
|
||
func _on_pressed() -> void: | ||
if Talo.identity_check() != OK: | ||
%ResponseLabel.text = "You need to identify a player first!" | ||
return | ||
|
||
if prop_name.is_empty() or prop_value.is_empty(): | ||
%ResponseLabel.text = "prop_name or prop_value not set on SetPropButton" | ||
return | ||
|
||
Talo.current_player.set_prop(prop_name, prop_value) |
Oops, something went wrong.