Skip to content

Commit bd12ee0

Browse files
authored
Merge pull request #61 from TaloDev/develop
Release 0.18.0
2 parents 41aa029 + 6c4b0ee commit bd12ee0

File tree

10 files changed

+50
-21
lines changed

10 files changed

+50
-21
lines changed

addons/talo/apis/feedback_api.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func get_categories() -> Array[TaloFeedbackCategory]:
1212
match (res.status):
1313
200:
1414
var categories: Array[TaloFeedbackCategory] = []
15-
categories.assign(res.body.categories.map(func (category: Dictionary): return TaloFeedbackCategory.new(category)))
15+
categories.assign(res.body.feedbackCategories.map(func (category: Dictionary): return TaloFeedbackCategory.new(category)))
1616
return categories
1717
_:
1818
return []

addons/talo/apis/game_config_api.gd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ class_name GameConfigAPI extends TaloAPI
77

88
## Emitted when the live config has been loaded.
99
signal live_config_loaded(live_config: TaloLiveConfig)
10+
signal live_config_updated(live_config: TaloLiveConfig)
11+
12+
func _ready() -> void:
13+
await Talo.init_completed
14+
Talo.socket.message_received.connect(_on_message_received)
15+
16+
func _on_message_received(res: String, data: Dictionary) -> void:
17+
if res == "v1.live-config.updated":
18+
live_config_updated.emit(TaloLiveConfig.new(data.config))
1019

1120
## Get the live config for your game.
1221
func get_live_config() -> void:

addons/talo/apis/saves_api.gd

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,7 @@ func get_saves() -> Array[TaloGameSave]:
5555
match (res.status):
5656
200:
5757
online_saves.append_array(res.body.saves.map(func (data: Dictionary): return TaloGameSave.new(data)))
58-
59-
if not offline_saves.is_empty():
60-
for online_save in online_saves:
61-
var filtered = offline_saves.filter(func (save: TaloGameSave): return save.id == online_save.id)
62-
if not filtered.is_empty():
63-
await _saves_manager.sync_save(online_save, filtered.front())
64-
65-
var synced_saves = await _saves_manager.sync_offline_saves(offline_saves)
66-
saves.append_array(synced_saves)
67-
68-
saves.append_array(online_saves)
58+
saves.append_array(await _saves_manager.get_synced_saves(online_saves))
6959

7060
_saves_manager.all_saves = saves
7161
saves_loaded.emit()

addons/talo/plugin.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
name="Talo Game Services"
44
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\n- Keep your data in-sync even when players are offline\n- Send channel messages between players"
55
author="trytalo"
6-
version="0.17.0"
6+
version="0.18.0"
77
script="talo_autoload.gd"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
11
extends Button
22

3+
func _ready() -> void:
4+
Talo.game_config.live_config_loaded.connect(_on_live_config_loaded)
5+
Talo.game_config.live_config_updated.connect(_on_live_config_updated)
6+
37
func _on_pressed() -> void:
48
Talo.game_config.get_live_config()
9+
10+
func _stringify_props(props: Array[TaloProp]) -> String:
11+
return JSON.stringify(props.map(func (prop: TaloProp): return prop.to_dictionary()))
12+
13+
func _on_live_config_loaded(config: TaloLiveConfig):
14+
%ResponseLabel.text = "Live config loaded: %s" % _stringify_props(config.props)
15+
16+
func _on_live_config_updated(live_config: TaloLiveConfig) -> void:
17+
%ResponseLabel.text = "Live config updated: %s" % _stringify_props(live_config.props)
Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
11
extends Label
2-
3-
func _ready() -> void:
4-
Talo.game_config.live_config_loaded.connect(_on_live_config_loaded)
5-
6-
func _on_live_config_loaded(config: TaloLiveConfig):
7-
text = JSON.stringify(config.props.map(func (prop: TaloProp): return prop.to_dictionary()))

addons/talo/talo_manager.gd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
extends Node
22

3+
signal init_completed
4+
35
var current_alias: TaloPlayerAlias
46
var current_player: TaloPlayer:
57
get:
@@ -37,6 +39,7 @@ func _ready() -> void:
3739

3840
get_tree().set_auto_accept_quit(false)
3941
process_mode = ProcessMode.PROCESS_MODE_ALWAYS
42+
init_completed.emit()
4043

4144
func _init_crypto_manager() -> void:
4245
crypto_manager = TaloCryptoManager.new()

addons/talo/utils/continuity_manager.gd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ const _continuity_timestamp_header = "X-Talo-Continuity-Timestamp"
99
const _excluded_endpoints: Array[String] = [
1010
"/v1/health-check",
1111
"/v1/players/auth",
12-
"/v1/players/identify"
12+
"/v1/players/identify",
13+
"/v1/socket-tickets"
1314
]
1415

1516
func _ready() -> void:

addons/talo/utils/saves_manager.gd

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ func sync_save(online_save: TaloGameSave, offline_save: TaloGameSave) -> TaloGam
3434
var offline_updated_at = Time.get_unix_time_from_datetime_string(offline_save.updated_at)
3535

3636
if offline_updated_at > online_updated_at:
37-
var save = await Talo.Saves.replace_save_with_offline_save(offline_save)
37+
var save = await Talo.saves.replace_save_with_offline_save(offline_save)
38+
delete_offline_save(offline_save)
3839
return save
3940

4041
return online_save
@@ -55,6 +56,24 @@ func sync_offline_saves(offline_saves: Array[TaloGameSave]) -> Array[TaloGameSav
5556

5657
return new_saves
5758

59+
func get_synced_saves(online_saves: Array[TaloGameSave]) -> Array[TaloGameSave]:
60+
var saves: Array[TaloGameSave] = []
61+
var offline_saves: Array[TaloGameSave] = read_offline_saves()
62+
63+
if not offline_saves.is_empty():
64+
for online_save in online_saves:
65+
var filtered = offline_saves.filter(func (save: TaloGameSave): return save.id == online_save.id)
66+
if not filtered.is_empty():
67+
var save = await sync_save(online_save, filtered.front())
68+
saves.push_back(save)
69+
else:
70+
saves.push_back(online_save)
71+
72+
var synced_saves = await sync_offline_saves(offline_saves)
73+
saves.append_array(synced_saves)
74+
75+
return saves
76+
5877
func update_offline_saves(incoming_save: TaloGameSave) -> void:
5978
var offline_saves: Array[TaloGameSave] = read_offline_saves()
6079
var updated = false

0 commit comments

Comments
 (0)