From 62390ac44fc977451a3d3cb6125bdff900d7e1ea Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Sun, 13 Oct 2024 22:26:35 +0100 Subject: [PATCH 1/7] optional event props --- addons/talo/apis/events_api.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/talo/apis/events_api.gd b/addons/talo/apis/events_api.gd index 8422c2b..f57b852 100644 --- a/addons/talo/apis/events_api.gd +++ b/addons/talo/apis/events_api.gd @@ -26,7 +26,7 @@ func _build_meta_props() -> Array[TaloProp]: func _has_errors(errors: Array) -> bool: return errors.any((func (err: Array): return err.size() > 0)) -func track(name: String, props: Dictionary) -> void: +func track(name: String, props: Dictionary = {}) -> void: if Talo.identity_check() != OK: return From 4ff62cdb5f306a168b59cffb6ee3c9f982de4543 Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Sun, 13 Oct 2024 22:27:04 +0100 Subject: [PATCH 2/7] fix return type for players_api.merge --- addons/talo/apis/players_api.gd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/talo/apis/players_api.gd b/addons/talo/apis/players_api.gd index d806322..f57b554 100644 --- a/addons/talo/apis/players_api.gd +++ b/addons/talo/apis/players_api.gd @@ -31,6 +31,6 @@ func merge(player_id1: String, player_id2: String) -> TaloPlayer: match (res.status): 200: - return res.body.player + return TaloPlayer.new(res.body.player) _: return null From a2c3fa6ba6833809cd859842de61d9b1cb91e8d5 Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Thu, 17 Oct 2024 08:37:28 +0100 Subject: [PATCH 3/7] follow gdscript styleguide (size 4 tabs) --- .vscode/settings.json | 5 + addons/talo/entities/entity_with_props.gd | 30 +++--- addons/talo/entities/feedback_category.gd | 14 +-- addons/talo/entities/leaderboard_entry.gd | 14 +-- addons/talo/entities/live_config.gd | 6 +- addons/talo/entities/loadable.gd | 54 +++++------ addons/talo/entities/player.gd | 22 ++--- addons/talo/entities/saved_object.gd | 26 +++--- .../authentication/scripts/authentication.gd | 46 +++++----- .../authentication/scripts/change_email.gd | 38 ++++---- .../authentication/scripts/change_password.gd | 38 ++++---- .../authentication/scripts/delete_account.gd | 27 ++++++ .../authentication/scripts/forgot_password.gd | 14 +-- .../samples/authentication/scripts/in_game.gd | 14 +-- .../samples/authentication/scripts/login.gd | 44 ++++----- .../authentication/scripts/register.gd | 36 ++++---- .../authentication/scripts/reset_password.gd | 34 +++---- .../samples/authentication/scripts/verify.gd | 26 +++--- .../authentication/states/delete_account.gd | 27 ------ .../authentication/states/delete_account.tscn | 2 +- .../leaderboards/scripts/leaderboard.gd | 92 +++++++++---------- .../leaderboards/scripts/leaderboard_entry.gd | 18 ++-- .../playground/scripts/delete_save_button.gd | 8 +- .../scripts/get_categories_button.gd | 12 +-- .../playground/scripts/identified_label.gd | 2 +- .../playground/scripts/identified_state.gd | 2 +- .../playground/scripts/load_save_button.gd | 18 ++-- .../playground/scripts/loadable_color_rect.gd | 14 +-- .../scripts/send_feedback_button.gd | 4 +- .../scripts/toggle_continuity_button.gd | 22 ++--- .../scripts/toggle_network_button.gd | 20 ++-- .../playground/scripts/update_save_button.gd | 22 ++--- addons/talo/samples/saves/loadable_button.gd | 18 ++-- .../samples/saves/stateful_buttons_manager.gd | 12 +-- addons/talo/utils/continuity_manager.gd | 84 ++++++++--------- addons/talo/utils/crypto_manager.gd | 40 ++++---- .../talo/utils/leaderboard_entries_manager.gd | 26 +++--- addons/talo/utils/saves_manager.gd | 2 +- addons/talo/utils/session_manager.gd | 40 ++++---- addons/talo/utils/talo_auth_error.gd | 30 +++--- addons/talo/utils/time_utils.gd | 4 +- 41 files changed, 506 insertions(+), 501 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 addons/talo/samples/authentication/scripts/delete_account.gd delete mode 100644 addons/talo/samples/authentication/states/delete_account.gd diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..827e449 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "editor.detectIndentation": false, + "editor.indentSize": "tabSize", + "editor.tabSize": 4 +} \ No newline at end of file diff --git a/addons/talo/entities/entity_with_props.gd b/addons/talo/entities/entity_with_props.gd index e635154..60ee358 100644 --- a/addons/talo/entities/entity_with_props.gd +++ b/addons/talo/entities/entity_with_props.gd @@ -3,26 +3,26 @@ class_name TaloEntityWithProps extends Node var props: Array[TaloProp] = [] func _init(props: Array) -> void: - self.props.assign(props) + self.props.assign(props) func get_prop(key: String, fallback: String = "") -> String: - var filtered = props.filter(func (prop: TaloProp): return prop.key == key && prop.value != null) - return fallback if filtered.is_empty() else filtered.front().value + var filtered = props.filter(func (prop: TaloProp): return prop.key == key && prop.value != null) + return fallback if filtered.is_empty() else filtered.front().value func set_prop(key: String, value: String) -> void: - var filtered = props.filter(func (prop: TaloProp): return prop.key == key) - if filtered.is_empty(): - props.push_back(TaloProp.new(key, value)) - else: - filtered.front().value = value + var filtered = props.filter(func (prop: TaloProp): return prop.key == key) + if filtered.is_empty(): + props.push_back(TaloProp.new(key, value)) + else: + filtered.front().value = value func delete_prop(key: String) -> void: - props.assign(props.map( - func (prop: TaloProp): - if prop.key == key: - prop.value = null - return prop - )) + props.assign(props.map( + func (prop: TaloProp): + if prop.key == key: + prop.value = null + return prop + )) func get_serialized_props() -> Array: - return props.map(func (prop: TaloProp): return prop.to_dictionary()) + return props.map(func (prop: TaloProp): return prop.to_dictionary()) diff --git a/addons/talo/entities/feedback_category.gd b/addons/talo/entities/feedback_category.gd index 413d6af..e6d1643 100644 --- a/addons/talo/entities/feedback_category.gd +++ b/addons/talo/entities/feedback_category.gd @@ -9,10 +9,10 @@ var created_at: String var updated_at: String func _init(data: Dictionary): - id = data.id - internal_name = data.internalName - display_name = data.name - description = data.description - anonymised = data.anonymised - created_at = data.createdAt - updated_at = data.updatedAt + id = data.id + internal_name = data.internalName + display_name = data.name + description = data.description + anonymised = data.anonymised + created_at = data.createdAt + updated_at = data.updatedAt diff --git a/addons/talo/entities/leaderboard_entry.gd b/addons/talo/entities/leaderboard_entry.gd index 75f1b4a..e503e70 100644 --- a/addons/talo/entities/leaderboard_entry.gd +++ b/addons/talo/entities/leaderboard_entry.gd @@ -8,11 +8,11 @@ var created_at: String var updated_at: String func _init(data: Dictionary): - super._init(data.props.map(func (prop): return TaloProp.new(prop.key, prop.value))) + super._init(data.props.map(func (prop): return TaloProp.new(prop.key, prop.value))) - id = data.id - position = data.position - score = data.score - player_alias = TaloPlayerAlias.new(data.playerAlias) - created_at = data.createdAt - updated_at = data.updatedAt + id = data.id + position = data.position + score = data.score + player_alias = TaloPlayerAlias.new(data.playerAlias) + created_at = data.createdAt + updated_at = data.updatedAt diff --git a/addons/talo/entities/live_config.gd b/addons/talo/entities/live_config.gd index 9ab8342..bf33551 100644 --- a/addons/talo/entities/live_config.gd +++ b/addons/talo/entities/live_config.gd @@ -3,8 +3,8 @@ class_name TaloLiveConfig extends Node var props: Array[TaloProp] = [] func _init(props: Array): - self.props.assign(props.map(func (prop): return TaloProp.new(prop.key, prop.value))) + self.props.assign(props.map(func (prop): return TaloProp.new(prop.key, prop.value))) func get_prop(key: String, fallback: String) -> String: - var filtered = props.filter(func (prop: TaloProp): return prop.key == key) - return fallback if filtered.is_empty() else filtered.front() + var filtered = props.filter(func (prop: TaloProp): return prop.key == key) + return fallback if filtered.is_empty() else filtered.front() diff --git a/addons/talo/entities/loadable.gd b/addons/talo/entities/loadable.gd index 662d82f..2a36189 100644 --- a/addons/talo/entities/loadable.gd +++ b/addons/talo/entities/loadable.gd @@ -4,51 +4,51 @@ class_name TaloLoadable extends Node var _saved_fields: Dictionary func _ready() -> void: - Talo.saves.save_chosen.connect(_load_data) - Talo.saves.register(self) + Talo.saves.save_chosen.connect(_load_data) + Talo.saves.register(self) func _load_data(save: TaloGameSave) -> void: - if not save: - return + if not save: + return - var fields = {} + var fields = {} - var filtered = save.content.objects.filter(func (obj: Dictionary): return obj.id == id) - if filtered.is_empty(): - push_warning("Loadable with id '%s' not found in save '%s'" % [id, save.display_name]) - return + var filtered = save.content.objects.filter(func (obj: Dictionary): return obj.id == id) + if filtered.is_empty(): + push_warning("Loadable with id '%s' not found in save '%s'" % [id, save.display_name]) + return - var saved_object = filtered.front() + var saved_object = filtered.front() - for item in saved_object.data: - fields[item.key] = type_convert(item.value, int(item.type)) + for item in saved_object.data: + fields[item.key] = type_convert(item.value, int(item.type)) - on_loaded(fields) + on_loaded(fields) - Talo.saves.set_object_loaded(id) + Talo.saves.set_object_loaded(id) func clear_saved_fields() -> void: - _saved_fields.clear() + _saved_fields.clear() func register_fields() -> void: - assert(false, "register_fields() must be implemented") + assert(false, "register_fields() must be implemented") func register_field(key: String, value: Variant) -> void: - _saved_fields[key] = value + _saved_fields[key] = value func on_loaded(data: Dictionary) -> void: - assert(false, "on_loaded() must be implemented") + assert(false, "on_loaded() must be implemented") func handle_destroyed(data: Dictionary) -> bool: - var destroyed = data.has("meta.destroyed") - if destroyed: - queue_free() + var destroyed = data.has("meta.destroyed") + if destroyed: + queue_free() - return destroyed + return destroyed func get_saved_object_data() -> Array: - return _saved_fields.keys().map( - func (key: String): - var value = _saved_fields[key] - return {key = key, value = str(value), type = str(typeof(value))} - ) + return _saved_fields.keys().map( + func (key: String): + var value = _saved_fields[key] + return {key = key, value = str(value), type = str(typeof(value))} + ) diff --git a/addons/talo/entities/player.gd b/addons/talo/entities/player.gd index 81919ff..7a4d993 100644 --- a/addons/talo/entities/player.gd +++ b/addons/talo/entities/player.gd @@ -4,23 +4,23 @@ var id: String var groups: Array[TaloGroup] = [] func _init(data: Dictionary): - super._init(data.props.map(func (prop): return TaloProp.new(prop.key, prop.value))) + super._init(data.props.map(func (prop): return TaloProp.new(prop.key, prop.value))) - id = data.id - groups.assign(data.groups.map(func (group): return TaloGroup.new(group.id, group.name))) + id = data.id + groups.assign(data.groups.map(func (group): return TaloGroup.new(group.id, group.name))) func set_prop(key: String, value: String, update: bool = true) -> void: - super.set_prop(key, value) - if update: - await Talo.players.update() + super.set_prop(key, value) + if update: + await Talo.players.update() func delete_prop(key: String, update: bool = true) -> void: - super.delete_prop(key) - if update: - await Talo.players.update() + super.delete_prop(key) + if update: + await Talo.players.update() func is_in_talo_group_id(group_id: String) -> bool: - return not groups.filter(func (group: TaloGroup): return group.id == group_id).is_empty() + return not groups.filter(func (group: TaloGroup): return group.id == group_id).is_empty() func is_in_talo_group_name(group_name: String) -> bool: - return not groups.filter(func (group: TaloGroup): return group.name == group_name).is_empty() + return not groups.filter(func (group: TaloGroup): return group.name == group_name).is_empty() diff --git a/addons/talo/entities/saved_object.gd b/addons/talo/entities/saved_object.gd index d13a13f..589a398 100644 --- a/addons/talo/entities/saved_object.gd +++ b/addons/talo/entities/saved_object.gd @@ -5,22 +5,22 @@ var object_name: String var loadable: TaloLoadable func _init(loadable: TaloLoadable) -> void: - id = loadable.id - object_name = loadable.get_path() - self.loadable = loadable + id = loadable.id + object_name = loadable.get_path() + self.loadable = loadable func register_loadable_fields(): - if is_instance_valid(loadable): - loadable.clear_saved_fields() - loadable.register_fields() + if is_instance_valid(loadable): + loadable.clear_saved_fields() + loadable.register_fields() func to_dictionary() -> Dictionary: - register_loadable_fields() + register_loadable_fields() - var destroyed_data = [{ key = "meta.destroyed", value = str(true), type = str(TYPE_BOOL) }] + var destroyed_data = [{ key = "meta.destroyed", value = str(true), type = str(TYPE_BOOL) }] - return { - id = id, - name = object_name, - data = destroyed_data if not is_instance_valid(loadable) else loadable.get_saved_object_data() - } + return { + id = id, + name = object_name, + data = destroyed_data if not is_instance_valid(loadable) else loadable.get_saved_object_data() + } diff --git a/addons/talo/samples/authentication/scripts/authentication.gd b/addons/talo/samples/authentication/scripts/authentication.gd index 0056584..519758e 100644 --- a/addons/talo/samples/authentication/scripts/authentication.gd +++ b/addons/talo/samples/authentication/scripts/authentication.gd @@ -12,38 +12,38 @@ extends Node2D @onready var all_states = %States func _ready() -> void: - _configure_signals() - _make_state_visible(login) + _configure_signals() + _make_state_visible(login) func _make_state_visible(state: Node2D): - for child in all_states.get_children(): - child.visible = child == state + for child in all_states.get_children(): + child.visible = child == state func _configure_signals(): - login.verification_required.connect(func (): _make_state_visible(verify)) - login.go_to_forgot_password.connect(func (): _make_state_visible(forgot_password)) - login.go_to_register.connect(func (): _make_state_visible(register)) + login.verification_required.connect(func (): _make_state_visible(verify)) + login.go_to_forgot_password.connect(func (): _make_state_visible(forgot_password)) + login.go_to_register.connect(func (): _make_state_visible(register)) - register.go_to_login.connect(func (): _make_state_visible(login)) + register.go_to_login.connect(func (): _make_state_visible(login)) - in_game.go_to_change_password.connect(func (): _make_state_visible(change_password)) - in_game.go_to_change_email.connect(func (): _make_state_visible(change_email)) - in_game.go_to_delete.connect(func (): _make_state_visible(delete_account)) - in_game.logout_success.connect(func (): _make_state_visible(login)) + in_game.go_to_change_password.connect(func (): _make_state_visible(change_password)) + in_game.go_to_change_email.connect(func (): _make_state_visible(change_email)) + in_game.go_to_delete.connect(func (): _make_state_visible(delete_account)) + in_game.logout_success.connect(func (): _make_state_visible(login)) - change_password.password_change_success.connect(func (): _make_state_visible(in_game)) - change_password.go_to_game.connect(func (): _make_state_visible(in_game)) + change_password.password_change_success.connect(func (): _make_state_visible(in_game)) + change_password.go_to_game.connect(func (): _make_state_visible(in_game)) - change_email.email_change_success.connect(func (): _make_state_visible(in_game)) - change_email.go_to_game.connect(func (): _make_state_visible(in_game)) + change_email.email_change_success.connect(func (): _make_state_visible(in_game)) + change_email.go_to_game.connect(func (): _make_state_visible(in_game)) - forgot_password.forgot_password_success.connect(func (): _make_state_visible(reset_password)) - forgot_password.go_to_login.connect(func (): _make_state_visible(login)) + forgot_password.forgot_password_success.connect(func (): _make_state_visible(reset_password)) + forgot_password.go_to_login.connect(func (): _make_state_visible(login)) - reset_password.password_reset_success.connect(func (): _make_state_visible(login)) - reset_password.go_to_forgot_password.connect(func (): _make_state_visible(forgot_password)) + reset_password.password_reset_success.connect(func (): _make_state_visible(login)) + reset_password.go_to_forgot_password.connect(func (): _make_state_visible(forgot_password)) - delete_account.delete_account_success.connect(func (): _make_state_visible(login)) - delete_account.go_to_game.connect(func (): _make_state_visible(in_game)) + delete_account.delete_account_success.connect(func (): _make_state_visible(login)) + delete_account.go_to_game.connect(func (): _make_state_visible(in_game)) - Talo.players.identified.connect(func (player): _make_state_visible(in_game)) + Talo.players.identified.connect(func (player): _make_state_visible(in_game)) diff --git a/addons/talo/samples/authentication/scripts/change_email.gd b/addons/talo/samples/authentication/scripts/change_email.gd index ae5c8ca..fa09eb3 100644 --- a/addons/talo/samples/authentication/scripts/change_email.gd +++ b/addons/talo/samples/authentication/scripts/change_email.gd @@ -8,27 +8,27 @@ signal go_to_game @onready var validation_label: Label = %ValidationLabel func _on_submit_pressed() -> void: - validation_label.text = "" + validation_label.text = "" - if not password.text: - validation_label.text = "Current password is required" - return + if not password.text: + validation_label.text = "Current password is required" + return - if not new_email.text: - validation_label.text = "New email is required" - return + if not new_email.text: + validation_label.text = "New email is required" + return - var res = await Talo.player_auth.change_email(password.text, new_email.text) - if res != OK: - match Talo.player_auth.last_error.get_code(): - TaloAuthError.ErrorCode.INVALID_CREDENTIALS: - validation_label.text = "Current password is incorrect" - TaloAuthError.ErrorCode.NEW_EMAIL_MATCHES_CURRENT_EMAIL: - validation_label.text = "New email must be different from the current email" - _: - validation_label.text = Talo.player_auth.last_error.get_string() - else: - email_change_success.emit() + var res = await Talo.player_auth.change_email(password.text, new_email.text) + if res != OK: + match Talo.player_auth.last_error.get_code(): + TaloAuthError.ErrorCode.INVALID_CREDENTIALS: + validation_label.text = "Current password is incorrect" + TaloAuthError.ErrorCode.NEW_EMAIL_MATCHES_CURRENT_EMAIL: + validation_label.text = "New email must be different from the current email" + _: + validation_label.text = Talo.player_auth.last_error.get_string() + else: + email_change_success.emit() func _on_cancel_pressed() -> void: - go_to_game.emit() + go_to_game.emit() diff --git a/addons/talo/samples/authentication/scripts/change_password.gd b/addons/talo/samples/authentication/scripts/change_password.gd index d61144d..0e50cc9 100644 --- a/addons/talo/samples/authentication/scripts/change_password.gd +++ b/addons/talo/samples/authentication/scripts/change_password.gd @@ -8,27 +8,27 @@ signal go_to_game @onready var validation_label: Label = %ValidationLabel func _on_submit_pressed() -> void: - validation_label.text = "" + validation_label.text = "" - if not current_password.text: - validation_label.text = "Current password is required" - return + if not current_password.text: + validation_label.text = "Current password is required" + return - if not new_password.text: - validation_label.text = "New password is required" - return + if not new_password.text: + validation_label.text = "New password is required" + return - var res = await Talo.player_auth.change_password(current_password.text, new_password.text) - if res != OK: - match Talo.player_auth.last_error.get_code(): - TaloAuthError.ErrorCode.INVALID_CREDENTIALS: - validation_label.text = "Current password is incorrect" - TaloAuthError.ErrorCode.NEW_PASSWORD_MATCHES_CURRENT_PASSWORD: - validation_label.text = "New password must be different from the current password" - _: - validation_label.text = Talo.player_auth.last_error.get_string() - else: - password_change_success.emit() + var res = await Talo.player_auth.change_password(current_password.text, new_password.text) + if res != OK: + match Talo.player_auth.last_error.get_code(): + TaloAuthError.ErrorCode.INVALID_CREDENTIALS: + validation_label.text = "Current password is incorrect" + TaloAuthError.ErrorCode.NEW_PASSWORD_MATCHES_CURRENT_PASSWORD: + validation_label.text = "New password must be different from the current password" + _: + validation_label.text = Talo.player_auth.last_error.get_string() + else: + password_change_success.emit() func _on_cancel_pressed() -> void: - go_to_game.emit() + go_to_game.emit() diff --git a/addons/talo/samples/authentication/scripts/delete_account.gd b/addons/talo/samples/authentication/scripts/delete_account.gd new file mode 100644 index 0000000..c181a5d --- /dev/null +++ b/addons/talo/samples/authentication/scripts/delete_account.gd @@ -0,0 +1,27 @@ +extends Node2D + +signal delete_account_success +signal go_to_game + +@onready var current_password: TextEdit = %CurrentPassword +@onready var validation_label: Label = %ValidationLabel + +func _on_delete_pressed() -> void: + validation_label.text = "" + + if not current_password.text: + validation_label.text = "Current password is required" + return + + var res = await Talo.player_auth.delete_account(current_password.text) + if res != OK: + match Talo.player_auth.last_error.get_code(): + TaloAuthError.ErrorCode.INVALID_CREDENTIALS: + validation_label.text = "Current password is incorrect" + _: + validation_label.text = Talo.player_auth.last_error.get_string() + else: + delete_account_success.emit() + +func _on_cancel_pressed() -> void: + go_to_game.emit() diff --git a/addons/talo/samples/authentication/scripts/forgot_password.gd b/addons/talo/samples/authentication/scripts/forgot_password.gd index 19bbdc9..321f0fe 100644 --- a/addons/talo/samples/authentication/scripts/forgot_password.gd +++ b/addons/talo/samples/authentication/scripts/forgot_password.gd @@ -7,14 +7,14 @@ signal go_to_login @onready var validation_label: Label = %ValidationLabel func _on_submit_pressed() -> void: - validation_label.text = "" + validation_label.text = "" - if not email.text: - validation_label.text = "Email is required" - return + if not email.text: + validation_label.text = "Email is required" + return - if await Talo.player_auth.forgot_password(email.text) == OK: - forgot_password_success.emit() + if await Talo.player_auth.forgot_password(email.text) == OK: + forgot_password_success.emit() func _on_cancel_pressed() -> void: - go_to_login.emit() + go_to_login.emit() diff --git a/addons/talo/samples/authentication/scripts/in_game.gd b/addons/talo/samples/authentication/scripts/in_game.gd index a0623ad..fdd86cf 100644 --- a/addons/talo/samples/authentication/scripts/in_game.gd +++ b/addons/talo/samples/authentication/scripts/in_game.gd @@ -8,20 +8,20 @@ signal logout_success @onready var username: Label = %Username func _ready() -> void: - Talo.players.identified.connect(_on_player_identified) + Talo.players.identified.connect(_on_player_identified) func _on_player_identified(player: TaloPlayer) -> void: - username.text = "What would you like to do,\n%s?" % [Talo.current_alias.identifier] + username.text = "What would you like to do,\n%s?" % [Talo.current_alias.identifier] func _on_change_password_pressed() -> void: - go_to_change_password.emit() + go_to_change_password.emit() func _on_change_email_pressed() -> void: - go_to_change_email.emit() + go_to_change_email.emit() func _on_logout_pressed() -> void: - await Talo.player_auth.logout() - logout_success.emit() + await Talo.player_auth.logout() + logout_success.emit() func _on_delete_pressed() -> void: - go_to_delete.emit() + go_to_delete.emit() diff --git a/addons/talo/samples/authentication/scripts/login.gd b/addons/talo/samples/authentication/scripts/login.gd index 66a9cb6..fc3987e 100644 --- a/addons/talo/samples/authentication/scripts/login.gd +++ b/addons/talo/samples/authentication/scripts/login.gd @@ -9,29 +9,29 @@ signal go_to_register @onready var validation_label: Label = %ValidationLabel func _on_submit_pressed() -> void: - validation_label.text = "" - - if not username.text: - validation_label.text = "Username is required" - return - - if not password.text: - validation_label.text = "Password is required" - return - - var res = await Talo.player_auth.login(username.text, password.text) - if res[0] != OK: - match Talo.player_auth.last_error.get_code(): - TaloAuthError.ErrorCode.INVALID_CREDENTIALS: - validation_label.text = "Username or password is incorrect" - _: - validation_label.text = Talo.player_auth.last_error.get_string() - else: - if res[1]: - verification_required.emit() + validation_label.text = "" + + if not username.text: + validation_label.text = "Username is required" + return + + if not password.text: + validation_label.text = "Password is required" + return + + var res = await Talo.player_auth.login(username.text, password.text) + if res[0] != OK: + match Talo.player_auth.last_error.get_code(): + TaloAuthError.ErrorCode.INVALID_CREDENTIALS: + validation_label.text = "Username or password is incorrect" + _: + validation_label.text = Talo.player_auth.last_error.get_string() + else: + if res[1]: + verification_required.emit() func _on_forgot_password_pressed() -> void: - go_to_forgot_password.emit() + go_to_forgot_password.emit() func _on_register_pressed() -> void: - go_to_register.emit() + go_to_register.emit() diff --git a/addons/talo/samples/authentication/scripts/register.gd b/addons/talo/samples/authentication/scripts/register.gd index b5c8237..e838360 100644 --- a/addons/talo/samples/authentication/scripts/register.gd +++ b/addons/talo/samples/authentication/scripts/register.gd @@ -9,27 +9,27 @@ signal go_to_login @onready var validation_label: Label = %ValidationLabel func _on_submit_button_pressed() -> void: - validation_label.text = "" + validation_label.text = "" - if not username.text: - validation_label.text = "Username is required" - return + if not username.text: + validation_label.text = "Username is required" + return - if not password.text: - validation_label.text = "Password is required" - return + if not password.text: + validation_label.text = "Password is required" + return - if enable_verification.button_pressed and not email.text: - validation_label.text = "Email is required when verification is enabled" - return + if enable_verification.button_pressed and not email.text: + validation_label.text = "Email is required when verification is enabled" + return - var res = await Talo.player_auth.register(username.text, password.text, email.text, enable_verification.button_pressed) - if res != OK: - match Talo.player_auth.last_error.get_code(): - TaloAuthError.ErrorCode.IDENTIFIER_TAKEN: - validation_label.text = "Username is already taken" - _: - validation_label.text = Talo.player_auth.last_error.get_string() + var res = await Talo.player_auth.register(username.text, password.text, email.text, enable_verification.button_pressed) + if res != OK: + match Talo.player_auth.last_error.get_code(): + TaloAuthError.ErrorCode.IDENTIFIER_TAKEN: + validation_label.text = "Username is already taken" + _: + validation_label.text = Talo.player_auth.last_error.get_string() func _on_login_pressed() -> void: - go_to_login.emit() + go_to_login.emit() diff --git a/addons/talo/samples/authentication/scripts/reset_password.gd b/addons/talo/samples/authentication/scripts/reset_password.gd index 077346c..57afe64 100644 --- a/addons/talo/samples/authentication/scripts/reset_password.gd +++ b/addons/talo/samples/authentication/scripts/reset_password.gd @@ -8,25 +8,25 @@ signal go_to_forgot_password @onready var validation_label: Label = %ValidationLabel func _on_submit_pressed() -> void: - validation_label.text = "" + validation_label.text = "" - if not code.text: - validation_label.text = "Code is required" - return + if not code.text: + validation_label.text = "Code is required" + return - if not new_password.text: - validation_label.text = "New password is required" - return + if not new_password.text: + validation_label.text = "New password is required" + return - var res = await Talo.player_auth.reset_password(code.text, new_password.text) - if res != OK: - match Talo.player_auth.last_error.get_code(): - TaloAuthError.ErrorCode.PASSWORD_RESET_CODE_INVALID: - validation_label.text = "Reset code is invalid" - _: - validation_label.text = Talo.player_auth.last_error.get_string() - else: - password_reset_success.emit() + var res = await Talo.player_auth.reset_password(code.text, new_password.text) + if res != OK: + match Talo.player_auth.last_error.get_code(): + TaloAuthError.ErrorCode.PASSWORD_RESET_CODE_INVALID: + validation_label.text = "Reset code is invalid" + _: + validation_label.text = Talo.player_auth.last_error.get_string() + else: + password_reset_success.emit() func _on_cancel_pressed() -> void: - go_to_forgot_password.emit() \ No newline at end of file + go_to_forgot_password.emit() diff --git a/addons/talo/samples/authentication/scripts/verify.gd b/addons/talo/samples/authentication/scripts/verify.gd index ad75845..39b1876 100644 --- a/addons/talo/samples/authentication/scripts/verify.gd +++ b/addons/talo/samples/authentication/scripts/verify.gd @@ -4,18 +4,18 @@ extends Node2D @onready var validation_label: Label = %ValidationLabel func _on_submit_pressed() -> void: - validation_label.text = "" + validation_label.text = "" - if not code.text: - validation_label.text = "Verification code is required" - return + if not code.text: + validation_label.text = "Verification code is required" + return - var res = await Talo.player_auth.verify(code.text) - if res != OK: - match Talo.player_auth.last_error.get_code(): - TaloAuthError.ErrorCode.VERIFICATION_CODE_INVALID: - validation_label.text = "Verification code is incorrect" - TaloAuthError.ErrorCode.VERIFICATION_ALIAS_NOT_FOUND: - validation_label.text = "Verification session is invalid" - _: - validation_label.text = Talo.player_auth.last_error.get_string() + var res = await Talo.player_auth.verify(code.text) + if res != OK: + match Talo.player_auth.last_error.get_code(): + TaloAuthError.ErrorCode.VERIFICATION_CODE_INVALID: + validation_label.text = "Verification code is incorrect" + TaloAuthError.ErrorCode.VERIFICATION_ALIAS_NOT_FOUND: + validation_label.text = "Verification session is invalid" + _: + validation_label.text = Talo.player_auth.last_error.get_string() diff --git a/addons/talo/samples/authentication/states/delete_account.gd b/addons/talo/samples/authentication/states/delete_account.gd deleted file mode 100644 index 945ea06..0000000 --- a/addons/talo/samples/authentication/states/delete_account.gd +++ /dev/null @@ -1,27 +0,0 @@ -extends Node2D - -signal delete_account_success -signal go_to_game - -@onready var current_password: TextEdit = %CurrentPassword -@onready var validation_label: Label = %ValidationLabel - -func _on_delete_pressed() -> void: - validation_label.text = "" - - if not current_password.text: - validation_label.text = "Current password is required" - return - - var res = await Talo.player_auth.delete_account(current_password.text) - if res != OK: - match Talo.player_auth.last_error.get_code(): - TaloAuthError.ErrorCode.INVALID_CREDENTIALS: - validation_label.text = "Current password is incorrect" - _: - validation_label.text = Talo.player_auth.last_error.get_string() - else: - delete_account_success.emit() - -func _on_cancel_pressed() -> void: - go_to_game.emit() diff --git a/addons/talo/samples/authentication/states/delete_account.tscn b/addons/talo/samples/authentication/states/delete_account.tscn index 7ad2602..4681c87 100644 --- a/addons/talo/samples/authentication/states/delete_account.tscn +++ b/addons/talo/samples/authentication/states/delete_account.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=7 format=3 uid="uid://d17bvaxw1qew4"] -[ext_resource type="Script" path="res://addons/talo/samples/authentication/states/delete_account.gd" id="1_ggdf5"] +[ext_resource type="Script" path="res://addons/talo/samples/authentication/scripts/delete_account.gd" id="1_ggdf5"] [ext_resource type="Theme" uid="uid://ce2uyi827vc5x" path="res://addons/talo/samples/authentication/assets/theme.tres" id="2_n2cbx"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_xxxlc"] diff --git a/addons/talo/samples/leaderboards/scripts/leaderboard.gd b/addons/talo/samples/leaderboards/scripts/leaderboard.gd index e5af432..96c4f84 100644 --- a/addons/talo/samples/leaderboards/scripts/leaderboard.gd +++ b/addons/talo/samples/leaderboards/scripts/leaderboard.gd @@ -15,74 +15,74 @@ var _filter: String = "All" var _filter_idx: int = 0 func _ready() -> void: - leaderboard_name.text = leaderboard_name.text.replace("{leaderboard}", leaderboard_internal_name) - await _load_entries() - _set_entry_count() + leaderboard_name.text = leaderboard_name.text.replace("{leaderboard}", leaderboard_internal_name) + await _load_entries() + _set_entry_count() func _set_entry_count(): - if entries_container.get_child_count() == 0: - info_label.text = "No entries yet!" if not _entries_error else "Failed loading leaderboard %s. Does it exist?" % [leaderboard_internal_name] - else: - info_label.text = "%s entries" % [entries_container.get_child_count()] - if _filter != "All": - info_label.text += " (%s team)" % [_filter] + if entries_container.get_child_count() == 0: + info_label.text = "No entries yet!" if not _entries_error else "Failed loading leaderboard %s. Does it exist?" % [leaderboard_internal_name] + else: + info_label.text = "%s entries" % [entries_container.get_child_count()] + if _filter != "All": + info_label.text += " (%s team)" % [_filter] func _create_entry(entry: TaloLeaderboardEntry) -> void: - var entry_instance = entry_scene.instantiate() - entry_instance.set_data(entry) - entries_container.add_child(entry_instance) + var entry_instance = entry_scene.instantiate() + entry_instance.set_data(entry) + entries_container.add_child(entry_instance) func _build_entries() -> void: - for child in entries_container.get_children(): - child.queue_free() + for child in entries_container.get_children(): + child.queue_free() - var entries = Talo.leaderboards.get_cached_entries(leaderboard_internal_name) - if _filter != "All": - entries = entries.filter(func (entry: TaloLeaderboardEntry): return entry.get_prop("team", "") == _filter) + var entries = Talo.leaderboards.get_cached_entries(leaderboard_internal_name) + if _filter != "All": + entries = entries.filter(func(entry: TaloLeaderboardEntry): return entry.get_prop("team", "") == _filter) - for entry in entries: - entry.position = entries.find(entry) - _create_entry(entry) + for entry in entries: + entry.position = entries.find(entry) + _create_entry(entry) func _load_entries() -> void: - var page = 0 - var done = false + var page = 0 + var done = false - while !done: - var res = await Talo.leaderboards.get_entries(leaderboard_internal_name, page) + while !done: + var res = await Talo.leaderboards.get_entries(leaderboard_internal_name, page) - if res.size() == 0: - _entries_error = true - return + if res.size() == 0: + _entries_error = true + return - var entries = res[0] - var last_page = res[2] + var entries = res[0] + var last_page = res[2] - if last_page: - done = true - else: - page += 1 + if last_page: + done = true + else: + page += 1 - _build_entries() + _build_entries() func _on_submit_pressed() -> void: - await Talo.players.identify("username", username.text) - var score = RandomNumberGenerator.new().randi_range(0, 100) - var team = "Blue" if RandomNumberGenerator.new().randi_range(0, 1) == 0 else "Red" + await Talo.players.identify("username", username.text) + var score = RandomNumberGenerator.new().randi_range(0, 100) + var team = "Blue" if RandomNumberGenerator.new().randi_range(0, 1) == 0 else "Red" - var res = await Talo.leaderboards.add_entry(leaderboard_internal_name, score, { team = team }) - info_label.text = "You scored %s points for the %s team!%s" % [score, team, " Your highscore was updated!" if res[1] else ""] + var res = await Talo.leaderboards.add_entry(leaderboard_internal_name, score, {team = team}) + info_label.text = "You scored %s points for the %s team!%s" % [score, team, " Your highscore was updated!" if res[1] else ""] - _build_entries() + _build_entries() func _get_next_filter(idx: int) -> String: - return ["All", "Blue", "Red"][idx % 3] + return ["All", "Blue", "Red"][idx % 3] func _on_filter_pressed() -> void: - _filter_idx += 1 - _filter = _get_next_filter(_filter_idx) + _filter_idx += 1 + _filter = _get_next_filter(_filter_idx) - info_label.text = "Filtering on %s" % [filter_button.text.to_lower()] - filter_button.text = "%s team scores" % [_get_next_filter(_filter_idx + 1)] + info_label.text = "Filtering on %s" % [filter_button.text.to_lower()] + filter_button.text = "%s team scores" % [_get_next_filter(_filter_idx + 1)] - _build_entries() + _build_entries() diff --git a/addons/talo/samples/leaderboards/scripts/leaderboard_entry.gd b/addons/talo/samples/leaderboards/scripts/leaderboard_entry.gd index eb79542..fafd7c0 100644 --- a/addons/talo/samples/leaderboards/scripts/leaderboard_entry.gd +++ b/addons/talo/samples/leaderboards/scripts/leaderboard_entry.gd @@ -1,20 +1,20 @@ extends Label func _set_pos(pos: int) -> void: - text = text.replace("{pos}", str(pos + 1)) + text = text.replace("{pos}", str(pos + 1)) func _set_username(username: String) -> void: - text = text.replace("{username}", username) + text = text.replace("{username}", username) func _set_score(score: int) -> void: - text = text.replace("{score}", str(int(score))) + text = text.replace("{score}", str(int(score))) func _set_team(team: String) -> void: - if not team.is_empty(): - text += " (%s team)" % [team] + if not team.is_empty(): + text += " (%s team)" % [team] func set_data(entry: TaloLeaderboardEntry) -> void: - _set_pos(entry.position) - _set_username(entry.player_alias.identifier) - _set_score(entry.score) - _set_team(entry.get_prop("team", "")) + _set_pos(entry.position) + _set_username(entry.player_alias.identifier) + _set_score(entry.score) + _set_team(entry.get_prop("team", "")) diff --git a/addons/talo/samples/playground/scripts/delete_save_button.gd b/addons/talo/samples/playground/scripts/delete_save_button.gd index 59dd76c..9cf7fcb 100644 --- a/addons/talo/samples/playground/scripts/delete_save_button.gd +++ b/addons/talo/samples/playground/scripts/delete_save_button.gd @@ -1,8 +1,8 @@ extends Button func _on_pressed() -> void: - if not Talo.saves.current: - push_error("No save currently loaded") - return + if not Talo.saves.current: + push_error("No save currently loaded") + return - Talo.saves.delete_save(Talo.saves.current) + Talo.saves.delete_save(Talo.saves.current) diff --git a/addons/talo/samples/playground/scripts/get_categories_button.gd b/addons/talo/samples/playground/scripts/get_categories_button.gd index 2232c54..8df394d 100644 --- a/addons/talo/samples/playground/scripts/get_categories_button.gd +++ b/addons/talo/samples/playground/scripts/get_categories_button.gd @@ -3,10 +3,10 @@ extends Button @onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" func _on_pressed() -> void: - var categories = await Talo.feedback.get_categories() + var categories = await Talo.feedback.get_categories() - if categories.size() == 0: - response_label.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) + if categories.size() == 0: + response_label.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) diff --git a/addons/talo/samples/playground/scripts/identified_label.gd b/addons/talo/samples/playground/scripts/identified_label.gd index 4da4551..ab69d36 100644 --- a/addons/talo/samples/playground/scripts/identified_label.gd +++ b/addons/talo/samples/playground/scripts/identified_label.gd @@ -4,4 +4,4 @@ func _ready() -> void: Talo.players.identified.connect(_on_identified) func _on_identified(_player: TaloPlayer) -> void: - text = "Played identified" + text = "Played identified" diff --git a/addons/talo/samples/playground/scripts/identified_state.gd b/addons/talo/samples/playground/scripts/identified_state.gd index 8f1aa3a..951b27b 100644 --- a/addons/talo/samples/playground/scripts/identified_state.gd +++ b/addons/talo/samples/playground/scripts/identified_state.gd @@ -4,4 +4,4 @@ func _ready() -> void: Talo.players.identified.connect(_on_identified) func _on_identified(_player: TaloPlayer) -> void: - color = Color(0.0, 190.0 / 255.0, 130.0 / 255.0) + color = Color(0.0, 190.0 / 255.0, 130.0 / 255.0) diff --git a/addons/talo/samples/playground/scripts/load_save_button.gd b/addons/talo/samples/playground/scripts/load_save_button.gd index a673366..215ce33 100644 --- a/addons/talo/samples/playground/scripts/load_save_button.gd +++ b/addons/talo/samples/playground/scripts/load_save_button.gd @@ -1,14 +1,14 @@ extends Button func _on_pressed() -> void: - var saves: Array[TaloGameSave] = Talo.saves.all + var saves: Array[TaloGameSave] = Talo.saves.all - if saves.is_empty(): - print("No saves, fetching...") - saves = await Talo.saves.get_saves() + if saves.is_empty(): + print("No saves, fetching...") + saves = await Talo.saves.get_saves() - if saves.is_empty(): - push_warning("No saves to load") - return - - Talo.saves.choose_save(Talo.saves.latest) + if saves.is_empty(): + push_warning("No saves to load") + return + + Talo.saves.choose_save(Talo.saves.latest) diff --git a/addons/talo/samples/playground/scripts/loadable_color_rect.gd b/addons/talo/samples/playground/scripts/loadable_color_rect.gd index 2cdbdaa..b468290 100644 --- a/addons/talo/samples/playground/scripts/loadable_color_rect.gd +++ b/addons/talo/samples/playground/scripts/loadable_color_rect.gd @@ -3,16 +3,16 @@ class_name LoadableColorRect extends TaloLoadable var color_rect: ColorRect func _ready() -> void: - super() - color_rect = get_child(1) + super() + color_rect = get_child(1) func register_fields() -> void: - register_field("r", color_rect.color.r) - register_field("g", color_rect.color.g) - register_field("b", color_rect.color.b) + register_field("r", color_rect.color.r) + register_field("g", color_rect.color.g) + register_field("b", color_rect.color.b) func on_loaded(data: Dictionary) -> void: - color_rect.color = Color(data["r"], data["g"], data["b"]) + color_rect.color = Color(data["r"], data["g"], data["b"]) func randomise() -> void: - color_rect.color = Color(randf(), randf(), randf()) + color_rect.color = Color(randf(), randf(), randf()) diff --git a/addons/talo/samples/playground/scripts/send_feedback_button.gd b/addons/talo/samples/playground/scripts/send_feedback_button.gd index 0c85172..309ea74 100644 --- a/addons/talo/samples/playground/scripts/send_feedback_button.gd +++ b/addons/talo/samples/playground/scripts/send_feedback_button.gd @@ -6,5 +6,5 @@ extends Button @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] + await Talo.feedback.send(internal_name, feedback_comment) + response_label.text = "Feedback sent for %s: %s" % [internal_name, feedback_comment] diff --git a/addons/talo/samples/playground/scripts/toggle_continuity_button.gd b/addons/talo/samples/playground/scripts/toggle_continuity_button.gd index a81a195..19c611f 100644 --- a/addons/talo/samples/playground/scripts/toggle_continuity_button.gd +++ b/addons/talo/samples/playground/scripts/toggle_continuity_button.gd @@ -3,21 +3,21 @@ extends Button @onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" func _ready() -> void: - _set_text(_get_value()) + _set_text(_get_value()) func _get_value(): - return Talo.settings.get_value("continuity", "enabled", true) + return Talo.settings.get_value("continuity", "enabled", true) func _set_text(enabled: bool): - text = "Toggle off" if enabled else "Toggle on" + text = "Toggle off" if enabled else "Toggle on" func _on_pressed() -> void: - var enabled = _get_value() + var enabled = _get_value() - Talo.settings.set_value( - "continuity", - "enabled", - not enabled - ) - _set_text(not enabled) - response_label.text = "Continuity is now " + ("enabled" if not enabled else "disabled") + Talo.settings.set_value( + "continuity", + "enabled", + not enabled + ) + _set_text(not enabled) + response_label.text = "Continuity is now " + ("enabled" if not enabled else "disabled") diff --git a/addons/talo/samples/playground/scripts/toggle_network_button.gd b/addons/talo/samples/playground/scripts/toggle_network_button.gd index 9e35cd5..b93f230 100644 --- a/addons/talo/samples/playground/scripts/toggle_network_button.gd +++ b/addons/talo/samples/playground/scripts/toggle_network_button.gd @@ -3,18 +3,18 @@ extends Button @onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" func _ready() -> void: - _set_text(Talo.offline_mode_enabled()) + _set_text(Talo.offline_mode_enabled()) func _set_text(offline: bool): - text = "Go online" if offline else "Go offline" + text = "Go online" if offline else "Go offline" func _on_pressed() -> void: - var offline = Talo.offline_mode_enabled() + var offline = Talo.offline_mode_enabled() - Talo.settings.set_value( - "debug", - "offline_mode", - not offline - ) - _set_text(not offline) - response_label.text = "You are now " + ("offline" if not offline else "online") + Talo.settings.set_value( + "debug", + "offline_mode", + not offline + ) + _set_text(not offline) + response_label.text = "You are now " + ("offline" if not offline else "online") diff --git a/addons/talo/samples/playground/scripts/update_save_button.gd b/addons/talo/samples/playground/scripts/update_save_button.gd index 52e0253..238e7f5 100644 --- a/addons/talo/samples/playground/scripts/update_save_button.gd +++ b/addons/talo/samples/playground/scripts/update_save_button.gd @@ -1,19 +1,19 @@ extends Button func _on_pressed() -> void: - if not Talo.saves.current: - push_error("No save currently loaded") - return + if not Talo.saves.current: + push_error("No save currently loaded") + return - var version = 0 + var version = 0 - var regex = RegEx.new() - regex.compile("version\\s+(\\d+)") + var regex = RegEx.new() + regex.compile("version\\s+(\\d+)") - var result = regex.search(Talo.saves.current.display_name) - if result: - version = int(result.get_string(1)) + var result = regex.search(Talo.saves.current.display_name) + if result: + version = int(result.get_string(1)) - var new_name = Talo.saves.current.display_name.replace("version %s" % [version], "version %s" % [version + 1]) + var new_name = Talo.saves.current.display_name.replace("version %s" % [version], "version %s" % [version + 1]) - Talo.saves.update_current_save(new_name) + Talo.saves.update_current_save(new_name) diff --git a/addons/talo/samples/saves/loadable_button.gd b/addons/talo/samples/saves/loadable_button.gd index a7b4e50..3c89a73 100644 --- a/addons/talo/samples/saves/loadable_button.gd +++ b/addons/talo/samples/saves/loadable_button.gd @@ -4,20 +4,20 @@ var button: Button var clicks: int = 0 func _ready() -> void: - super() - button = get_child(0) + super() + button = get_child(0) func register_fields() -> void: - register_field("clicks", clicks) + register_field("clicks", clicks) func _set_button_text() -> void: - button.text = "%s clicks" % [clicks] + button.text = "%s clicks" % [clicks] func on_loaded(data: Dictionary) -> void: - clicks = data["clicks"] - _set_button_text() + clicks = data["clicks"] + _set_button_text() func _on_button_pressed() -> void: - clicks += 1 - _set_button_text() - await Talo.saves.update_current_save() + clicks += 1 + _set_button_text() + await Talo.saves.update_current_save() diff --git a/addons/talo/samples/saves/stateful_buttons_manager.gd b/addons/talo/samples/saves/stateful_buttons_manager.gd index 33a31be..f0e00de 100644 --- a/addons/talo/samples/saves/stateful_buttons_manager.gd +++ b/addons/talo/samples/saves/stateful_buttons_manager.gd @@ -3,12 +3,12 @@ extends Node2D @export var username: String = "username" func _ready() -> void: - Talo.players.identified.connect(_on_identified) - Talo.players.identify("username", username) + Talo.players.identified.connect(_on_identified) + Talo.players.identify("username", username) func _on_identified(_player: TaloPlayer) -> void: - var saves = await Talo.saves.get_saves() - if saves.is_empty(): - await Talo.saves.create_save("save") + var saves = await Talo.saves.get_saves() + if saves.is_empty(): + await Talo.saves.create_save("save") - await Talo.saves.set_chosen_save(Talo.saves.all.front()) + await Talo.saves.set_chosen_save(Talo.saves.all.front()) diff --git a/addons/talo/utils/continuity_manager.gd b/addons/talo/utils/continuity_manager.gd index a33e645..980f537 100644 --- a/addons/talo/utils/continuity_manager.gd +++ b/addons/talo/utils/continuity_manager.gd @@ -7,68 +7,68 @@ const _continuity_path = "user://tc.bin" const _continuity_timestamp_header = "X-Talo-Continuity-Timestamp" const _excluded_endpoints: Array[String] = [ - "/v1/health-check", - "/v1/players/auth", - "/v1/players/identify" + "/v1/health-check", + "/v1/players/auth", + "/v1/players/identify" ] func _ready() -> void: - name = "TaloContinuityManager" - _client = TaloClient.new("") - add_child(_client) + name = "TaloContinuityManager" + _client = TaloClient.new("") + add_child(_client) - _requests = _read_requests() + _requests = _read_requests() - wait_time = 10 - connect("timeout", _on_timeout) - start() + wait_time = 10 + connect("timeout", _on_timeout) + start() func push_request(method: HTTPClient.Method, url: String, body: Dictionary, headers: Array[String], timestamp: int): - if not Talo.settings.get_value("continuity", "enabled", true): - return + if not Talo.settings.get_value("continuity", "enabled", true): + return - if _excluded_endpoints.any(func (endpoint: String): return url.find(endpoint) != -1): - return + if _excluded_endpoints.any(func (endpoint: String): return url.find(endpoint) != -1): + return - _requests.push_back({ - method = method, - url = url, - body = body, - headers = headers.filter(func (h: String): return h.find("Authorization") == -1), - timestamp = timestamp - }) + _requests.push_back({ + method = method, + url = url, + body = body, + headers = headers.filter(func (h: String): return h.find("Authorization") == -1), + timestamp = timestamp + }) - _write_requests() + _write_requests() func _read_requests() -> Array: - if not FileAccess.file_exists(_continuity_path): - return [] + if not FileAccess.file_exists(_continuity_path): + return [] - var content = FileAccess.open_encrypted_with_pass(_continuity_path, FileAccess.READ, Talo.crypto_manager.get_key()) - var json = JSON.new() - json.parse(content.get_as_text()) + var content = FileAccess.open_encrypted_with_pass(_continuity_path, FileAccess.READ, Talo.crypto_manager.get_key()) + var json = JSON.new() + json.parse(content.get_as_text()) - return json.get_data() + return json.get_data() func _write_requests(): - var file = FileAccess.open_encrypted_with_pass(_continuity_path, FileAccess.WRITE, Talo.crypto_manager.get_key()) - file.store_line(JSON.stringify(_requests)) + var file = FileAccess.open_encrypted_with_pass(_continuity_path, FileAccess.WRITE, Talo.crypto_manager.get_key()) + file.store_line(JSON.stringify(_requests)) func _on_timeout(): - if _requests.is_empty() || not (await Talo.health_check.ping()): - return + if _requests.is_empty() || not (await Talo.health_check.ping()): + return - for i in range(10): - if _requests.is_empty(): - break + for i in range(10): + if _requests.is_empty(): + break - var req = _requests.pop_front() - _write_requests() + var req = _requests.pop_front() + _write_requests() - var headers: Array[String] = ["Authorization: Bearer %s" % Talo.settings.get_value("", "access_key")] - headers.append_array(req.headers) + var headers: Array[String] = ["Authorization: Bearer %s" % Talo.settings.get_value("", "access_key")] + headers.append_array(req.headers) - if not req.headers.any(func (h: String): return h.find(_continuity_timestamp_header) != -1): - headers.append("%s: %s" % [_continuity_timestamp_header, req.timestamp]) + if not req.headers.any(func (h: String): return h.find(_continuity_timestamp_header) != -1): + headers.append("%s: %s" % [_continuity_timestamp_header, req.timestamp]) - await _client.make_request(req.method, req.url, req.body, headers, true) + await _client.make_request(req.method, req.url, req.body, headers, true) diff --git a/addons/talo/utils/crypto_manager.gd b/addons/talo/utils/crypto_manager.gd index 32ddf6d..cb44ab9 100644 --- a/addons/talo/utils/crypto_manager.gd +++ b/addons/talo/utils/crypto_manager.gd @@ -3,30 +3,30 @@ class_name TaloCryptoManager extends Node var _key_file_path = "user://ti.bin" func _get_pass() -> String: - if OS.has_feature("web"): - return Talo.settings.get_value("", "access_key") + if OS.has_feature("web"): + return Talo.settings.get_value("", "access_key") - return OS.get_unique_id() + return OS.get_unique_id() func _init() -> void: - if not FileAccess.file_exists(_key_file_path): - if _get_pass().is_empty(): - push_error("Unable to create key file: cannot generate a suitable password") - return + if not FileAccess.file_exists(_key_file_path): + if _get_pass().is_empty(): + push_error("Unable to create key file: cannot generate a suitable password") + return - var crypto = Crypto.new() - var key = crypto.generate_random_bytes(32).hex_encode() + var crypto = Crypto.new() + var key = crypto.generate_random_bytes(32).hex_encode() - var file = FileAccess.open_encrypted_with_pass(_key_file_path, FileAccess.WRITE, _get_pass()) - file.store_line(key) - file.close() + var file = FileAccess.open_encrypted_with_pass(_key_file_path, FileAccess.WRITE, _get_pass()) + file.store_line(key) + file.close() func get_key() -> String: - if not FileAccess.file_exists(_key_file_path): - push_error("Talo key file has not been created") - return "" - - var file = FileAccess.open_encrypted_with_pass(_key_file_path, FileAccess.READ, _get_pass()) - var key = file.get_as_text() - file.close() - return key + if not FileAccess.file_exists(_key_file_path): + push_error("Talo key file has not been created") + return "" + + var file = FileAccess.open_encrypted_with_pass(_key_file_path, FileAccess.READ, _get_pass()) + var key = file.get_as_text() + file.close() + return key diff --git a/addons/talo/utils/leaderboard_entries_manager.gd b/addons/talo/utils/leaderboard_entries_manager.gd index 991a733..4128d4d 100644 --- a/addons/talo/utils/leaderboard_entries_manager.gd +++ b/addons/talo/utils/leaderboard_entries_manager.gd @@ -3,20 +3,20 @@ class_name TaloLeaderboardEntriesManager extends Node var _current_entries: Dictionary = {} func get_entries(internal_name: String) -> Array: - return _current_entries.get(internal_name, []) + return _current_entries.get(internal_name, []) func upsert_entry(internal_name: String, entry: TaloLeaderboardEntry) -> void: - if not _current_entries.has(internal_name): - _current_entries[internal_name] = [] - else: - _current_entries[internal_name] = _current_entries[internal_name].filter( - func (e: TaloLeaderboardEntry): return e.id != entry.id - ) + if not _current_entries.has(internal_name): + _current_entries[internal_name] = [] + else: + _current_entries[internal_name] = _current_entries[internal_name].filter( + func (e: TaloLeaderboardEntry): return e.id != entry.id + ) - if entry.position >= _current_entries[internal_name].size(): - _current_entries[internal_name].append(entry) - else: - _current_entries[internal_name].insert(entry.position, entry) + if entry.position >= _current_entries[internal_name].size(): + _current_entries[internal_name].append(entry) + else: + _current_entries[internal_name].insert(entry.position, entry) - for idx in range(entry.position, _current_entries[internal_name].size()): - _current_entries[internal_name][idx].position = idx + for idx in range(entry.position, _current_entries[internal_name].size()): + _current_entries[internal_name][idx].position = idx diff --git a/addons/talo/utils/saves_manager.gd b/addons/talo/utils/saves_manager.gd index 7ee6ced..74daa4c 100644 --- a/addons/talo/utils/saves_manager.gd +++ b/addons/talo/utils/saves_manager.gd @@ -92,7 +92,7 @@ func set_object_loaded(id: String) -> void: func get_save_content() -> Dictionary: return { objects = _registered_saved_objects.map(func (saved_object: TaloSavedObject): return saved_object.to_dictionary()) - } + } func replace_save(new_save: TaloGameSave) -> void: var existing_saves = all_saves.filter(func (save): return save.id == new_save.id) diff --git a/addons/talo/utils/session_manager.gd b/addons/talo/utils/session_manager.gd index 0839e20..159bca7 100644 --- a/addons/talo/utils/session_manager.gd +++ b/addons/talo/utils/session_manager.gd @@ -4,38 +4,38 @@ var _config_file_path = "user://talo_session.cfg" var _verification_alias_id = "" func _load_config() -> ConfigFile: - var config = ConfigFile.new() - config.load(_config_file_path) - return config + var config = ConfigFile.new() + config.load(_config_file_path) + return config func _save_session(session_token: String) -> void: - var config = ConfigFile.new() - config.set_value("session", "token", session_token) - config.set_value("session", "identifier", Talo.current_alias.identifier) - config.save(_config_file_path) + var config = ConfigFile.new() + config.set_value("session", "token", session_token) + config.set_value("session", "identifier", Talo.current_alias.identifier) + config.save(_config_file_path) func clear_session() -> void: - var config = _load_config() + var config = _load_config() - if config.has_section("session"): - config.erase_section("session") - config.save(_config_file_path) + if config.has_section("session"): + config.erase_section("session") + config.save(_config_file_path) func load_session() -> String: - var config = _load_config() - return config.get_value("session", "token", "") + var config = _load_config() + return config.get_value("session", "token", "") func get_identifier() -> String: - var config = _load_config() - return config.get_value("session", "identifier", "") + var config = _load_config() + return config.get_value("session", "identifier", "") func save_verification_alias_id(alias_id: int) -> void: - _verification_alias_id = alias_id + _verification_alias_id = alias_id func get_verification_alias_id() -> int: - return _verification_alias_id + return _verification_alias_id func handle_session_created(alias: Dictionary, session_token: String) -> void: - Talo.current_alias = TaloPlayerAlias.new(alias) - Talo.players.identified.emit(Talo.current_player) - _save_session(session_token) + Talo.current_alias = TaloPlayerAlias.new(alias) + Talo.players.identified.emit(Talo.current_player) + _save_session(session_token) diff --git a/addons/talo/utils/talo_auth_error.gd b/addons/talo/utils/talo_auth_error.gd index f115733..6c39779 100644 --- a/addons/talo/utils/talo_auth_error.gd +++ b/addons/talo/utils/talo_auth_error.gd @@ -1,28 +1,28 @@ class_name TaloAuthError extends Node enum ErrorCode { - API_ERROR, - INVALID_CREDENTIALS, - VERIFICATION_ALIAS_NOT_FOUND, - VERIFICATION_CODE_INVALID, - IDENTIFIER_TAKEN, - MISSING_SESSION, - INVALID_SESSION, - NEW_PASSWORD_MATCHES_CURRENT_PASSWORD, - NEW_EMAIL_MATCHES_CURRENT_EMAIL, - PASSWORD_RESET_CODE_INVALID + API_ERROR, + INVALID_CREDENTIALS, + VERIFICATION_ALIAS_NOT_FOUND, + VERIFICATION_CODE_INVALID, + IDENTIFIER_TAKEN, + MISSING_SESSION, + INVALID_SESSION, + NEW_PASSWORD_MATCHES_CURRENT_PASSWORD, + NEW_EMAIL_MATCHES_CURRENT_EMAIL, + PASSWORD_RESET_CODE_INVALID } var _error_string = "" func _init(error_string: String) -> void: - _error_string = error_string + _error_string = error_string func get_string() -> String: - if _error_string == "API_ERROR": - return "API error - see the Errors Output for more details" + if _error_string == "API_ERROR": + return "API error - see the Errors Output for more details" - return _error_string + return _error_string func get_code() -> ErrorCode: - return ErrorCode.get(_error_string) + return ErrorCode.get(_error_string) diff --git a/addons/talo/utils/time_utils.gd b/addons/talo/utils/time_utils.gd index 460fe99..7270a7b 100644 --- a/addons/talo/utils/time_utils.gd +++ b/addons/talo/utils/time_utils.gd @@ -1,7 +1,7 @@ class_name TimeUtils extends Node static func get_current_time_msec() -> String: - return Time.get_datetime_string_from_unix_time(int(Time.get_unix_time_from_system())) + return Time.get_datetime_string_from_unix_time(int(Time.get_unix_time_from_system())) static func get_timestamp_msec() -> int: - return ceil(Time.get_unix_time_from_system()) * 1000 + return ceil(Time.get_unix_time_from_system()) * 1000 From 2c710c4cf677f9a0d2ed43029b6d6d1c1527a402 Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:38:09 +0100 Subject: [PATCH 4/7] update settings --- .vscode/settings.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 827e449..086681e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,5 @@ { - "editor.detectIndentation": false, + "editor.detectIndentation": true, "editor.indentSize": "tabSize", "editor.tabSize": 4 } \ No newline at end of file From 4b3a207815bef9c5133efd1f149ba062c6825dee Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:51:28 +0100 Subject: [PATCH 5/7] dont insert spaces --- .vscode/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 086681e..224c9c4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { "editor.detectIndentation": true, + "editor.insertSpaces": false, "editor.indentSize": "tabSize", "editor.tabSize": 4 } \ No newline at end of file From 59aa9c0948331e995825c1ca9ceef379fc048cff Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Sat, 19 Oct 2024 21:57:34 +0100 Subject: [PATCH 6/7] player groups api --- addons/talo/apis/player_groups_api.gd | 10 ++++++++ addons/talo/entities/player.gd | 8 +++--- addons/talo/entities/player_group.gd | 25 +++++++++++++++++++ .../{group.gd => player_group_stub.gd} | 2 +- .../talo/samples/playground/playground.tscn | 9 ++++++- .../playground/scripts/get_group_button.gd | 14 +++++++++++ addons/talo/talo_manager.gd | 5 +++- addons/talo/utils/continuity_manager.gd | 4 +++ 8 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 addons/talo/apis/player_groups_api.gd create mode 100644 addons/talo/entities/player_group.gd rename addons/talo/entities/{group.gd => player_group_stub.gd} (75%) create mode 100644 addons/talo/samples/playground/scripts/get_group_button.gd diff --git a/addons/talo/apis/player_groups_api.gd b/addons/talo/apis/player_groups_api.gd new file mode 100644 index 0000000..be72a9c --- /dev/null +++ b/addons/talo/apis/player_groups_api.gd @@ -0,0 +1,10 @@ +class_name PlayerGroupsAPI extends TaloAPI + +func get_group(group_id: String) -> TaloPlayerGroup: + var res = await client.make_request(HTTPClient.METHOD_GET, "/%s" % [group_id]) + + match (res.status): + 200: + return TaloPlayerGroup.new(res.body.group) + _: + return null diff --git a/addons/talo/entities/player.gd b/addons/talo/entities/player.gd index 7a4d993..62b7ef6 100644 --- a/addons/talo/entities/player.gd +++ b/addons/talo/entities/player.gd @@ -1,13 +1,13 @@ class_name TaloPlayer extends TaloEntityWithProps var id: String -var groups: Array[TaloGroup] = [] +var groups: Array[TaloPlayerGroupStub] = [] func _init(data: Dictionary): super._init(data.props.map(func (prop): return TaloProp.new(prop.key, prop.value))) id = data.id - groups.assign(data.groups.map(func (group): return TaloGroup.new(group.id, group.name))) + groups.assign(data.groups.map(func (group): return TaloPlayerGroupStub.new(group.id, group.name))) func set_prop(key: String, value: String, update: bool = true) -> void: super.set_prop(key, value) @@ -20,7 +20,7 @@ func delete_prop(key: String, update: bool = true) -> void: await Talo.players.update() func is_in_talo_group_id(group_id: String) -> bool: - return not groups.filter(func (group: TaloGroup): return group.id == group_id).is_empty() + return not groups.filter(func (group: TaloPlayerGroupStub): return group.id == group_id).is_empty() func is_in_talo_group_name(group_name: String) -> bool: - return not groups.filter(func (group: TaloGroup): return group.name == group_name).is_empty() + return not groups.filter(func (group: TaloPlayerGroupStub): return group.name == group_name).is_empty() diff --git a/addons/talo/entities/player_group.gd b/addons/talo/entities/player_group.gd new file mode 100644 index 0000000..9249a0d --- /dev/null +++ b/addons/talo/entities/player_group.gd @@ -0,0 +1,25 @@ +class_name TaloPlayerGroup extends Node + +var id: String +var display_name: String +var description: String +var rules: Array +var rule_mode: String +var members_visible: bool +var count: int +var members: Array[TaloPlayer] +var updated_at: String + +func _init(data: Dictionary): + id = data.id + display_name = data.name + description = data.description + rules = data.rules + rule_mode = data.ruleMode + members_visible = data.membersVisible + count = data.count + if data.has("members"): + members.assign(data.members.map(func (member): return TaloPlayer.new(member))) + else: + members = [] + updated_at = data.updatedAt diff --git a/addons/talo/entities/group.gd b/addons/talo/entities/player_group_stub.gd similarity index 75% rename from addons/talo/entities/group.gd rename to addons/talo/entities/player_group_stub.gd index 3bdc49d..4253266 100644 --- a/addons/talo/entities/group.gd +++ b/addons/talo/entities/player_group_stub.gd @@ -1,4 +1,4 @@ -class_name TaloGroup extends Node +class_name TaloPlayerGroupStub extends Node var id: String var display_name: String diff --git a/addons/talo/samples/playground/playground.tscn b/addons/talo/samples/playground/playground.tscn index b8c41bc..f1513fd 100644 --- a/addons/talo/samples/playground/playground.tscn +++ b/addons/talo/samples/playground/playground.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://bg71kho7jirad"] +[gd_scene load_steps=24 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"] @@ -10,6 +10,7 @@ [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/discover_secret_button.gd" id="5_wpnvd"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/delete_health_button.gd" id="6_it1yx"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/toggle_continuity_button.gd" id="6_pvyh2"] +[ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/get_group_button.gd" id="7_5qx11"] [ext_resource type="Script" path="res://addons/talo/samples/playground/scripts/toggle_network_button.gd" id="7_wsc44"] [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"] @@ -103,6 +104,11 @@ layout_mode = 2 text = "Delete health" script = ExtResource("6_it1yx") +[node name="GetGroupButton" type="Button" parent="UI/MarginContainer/APIs/Players_Continuity/Players"] +layout_mode = 2 +text = "Get group" +script = ExtResource("7_5qx11") + [node name="Continuity" type="VBoxContainer" parent="UI/MarginContainer/APIs/Players_Continuity"] layout_mode = 2 theme_override_constants/separation = 20 @@ -467,6 +473,7 @@ feedback_comment = "There is a bug in the game somewhere, go find it" [connection signal="pressed" from="UI/MarginContainer/APIs/Players_Continuity/Players/IdentifyButton" to="UI/MarginContainer/APIs/Players_Continuity/Players/IdentifyButton" method="_on_pressed"] [connection signal="pressed" from="UI/MarginContainer/APIs/Players_Continuity/Players/SetHealthButton" to="UI/MarginContainer/APIs/Players_Continuity/Players/SetHealthButton" method="_on_pressed"] [connection signal="pressed" from="UI/MarginContainer/APIs/Players_Continuity/Players/DeleteHealthButton" to="UI/MarginContainer/APIs/Players_Continuity/Players/DeleteHealthButton" method="_on_pressed"] +[connection signal="pressed" from="UI/MarginContainer/APIs/Players_Continuity/Players/GetGroupButton" to="UI/MarginContainer/APIs/Players_Continuity/Players/GetGroupButton" method="_on_pressed"] [connection signal="pressed" from="UI/MarginContainer/APIs/Players_Continuity/Continuity/ToggleContinuityButton" to="UI/MarginContainer/APIs/Players_Continuity/Continuity/ToggleContinuityButton" method="_on_pressed"] [connection signal="pressed" from="UI/MarginContainer/APIs/Players_Continuity/Continuity/ToggleNetworkButton" to="UI/MarginContainer/APIs/Players_Continuity/Continuity/ToggleNetworkButton" method="_on_pressed"] [connection signal="pressed" from="UI/MarginContainer/APIs/Events/LevelUpButton" to="UI/MarginContainer/APIs/Events/LevelUpButton" method="_on_pressed"] diff --git a/addons/talo/samples/playground/scripts/get_group_button.gd b/addons/talo/samples/playground/scripts/get_group_button.gd new file mode 100644 index 0000000..d239464 --- /dev/null +++ b/addons/talo/samples/playground/scripts/get_group_button.gd @@ -0,0 +1,14 @@ +extends Button + +@onready var response_label: Label = $"/root/Playground/UI/MarginContainer/ResponseLabel" +@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]) + else: + print_rich("[color=yellow]group_id not set on GetGroupButton[/color]") diff --git a/addons/talo/talo_manager.gd b/addons/talo/talo_manager.gd index 82e43b2..4bfaf97 100644 --- a/addons/talo/talo_manager.gd +++ b/addons/talo/talo_manager.gd @@ -16,6 +16,7 @@ var saves: SavesAPI var feedback: FeedbackAPI var player_auth: PlayerAuthAPI var health_check: HealthCheckAPI +var player_groups: PlayerGroupsAPI var live_config: TaloLiveConfig @@ -74,6 +75,7 @@ func _load_apis() -> void: feedback = preload("res://addons/talo/apis/feedback_api.gd").new("/v1/game-feedback") player_auth = preload("res://addons/talo/apis/player_auth_api.gd").new("/v1/players/auth") health_check = preload("res://addons/talo/apis/health_check_api.gd").new("/v1/health-check") + player_groups = preload("res://addons/talo/apis/player_groups_api.gd").new("/v1/player-groups") for api in [ players, @@ -84,7 +86,8 @@ func _load_apis() -> void: saves, feedback, player_auth, - health_check + health_check, + player_groups ]: add_child(api) diff --git a/addons/talo/utils/continuity_manager.gd b/addons/talo/utils/continuity_manager.gd index 980f537..0989fa7 100644 --- a/addons/talo/utils/continuity_manager.gd +++ b/addons/talo/utils/continuity_manager.gd @@ -45,6 +45,10 @@ func _read_requests() -> Array: return [] var content = FileAccess.open_encrypted_with_pass(_continuity_path, FileAccess.READ, Talo.crypto_manager.get_key()) + if content == null: + DirAccess.remove_absolute(_continuity_path) + return [] + var json = JSON.new() json.parse(content.get_as_text()) From 5bcb9e56bc2bcb07de09a4a99d131fd866a0b8e1 Mon Sep 17 00:00:00 2001 From: tudor <7089284+tudddorrr@users.noreply.github.com> Date: Sun, 20 Oct 2024 09:53:39 +0100 Subject: [PATCH 7/7] 0.11.0 --- addons/talo/plugin.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/talo/plugin.cfg b/addons/talo/plugin.cfg index 32dfb51..9767ffa 100644 --- a/addons/talo/plugin.cfg +++ b/addons/talo/plugin.cfg @@ -3,5 +3,5 @@ name="Talo Game Services" description="Talo (https://trytalo.com) is an open-source game backend with services designed to help you build games faster. You can currently:\n\n- Identify and authenticate players\n- Store persistent data across players\n- Track events (levelling up, finding loot, etc)\n- Display high scores with leaderboards\n- Store and load player saves\n- Load game config options and flags from the cloud\n- Get feedback directly from your players" author="trytalo" -version="0.10.1" +version="0.11.0" script="talo_autoload.gd"