diff --git a/Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs b/Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs index b6898b1..3f39e18 100644 --- a/Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs +++ b/Assets/Talo Game Services/Talo/Runtime/APIs/PlayersAPI.cs @@ -5,6 +5,11 @@ namespace TaloGameServices { + public class MergeOptions + { + public string postMergeIdentityService = ""; + } + public class PlayersAPI : BaseAPI { public event Action OnIdentified; @@ -113,14 +118,27 @@ public async Task Update() return Talo.CurrentPlayer; } - public async Task Merge(string playerId1, string playerId2) + public async Task Merge(string playerId1, string playerId2, MergeOptions options = null) { + options ??= new MergeOptions(); + var uri = new Uri($"{baseUrl}/merge"); string content = JsonUtility.ToJson(new PlayersMergeRequest(playerId1, playerId2)); var json = await Call(uri, "POST", content); var res = JsonUtility.FromJson(json); - return res.player; + var player = res.player; + + if (options.postMergeIdentityService != "") + { + var alias = player.GetAlias(options.postMergeIdentityService); + if (alias != null) + { + await Identify(alias.service, alias.identifier); + } + } + + return player; } public async Task Find(string playerId)