Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Packages/com.trytalo.talo/Runtime/Entities/Group.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[System.Serializable]
public class Group
{
public string id, name;
}
11 changes: 11 additions & 0 deletions Packages/com.trytalo.talo/Runtime/Entities/Group.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Packages/com.trytalo.talo/Runtime/Entities/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public class Player
{
public string id;
public Prop[] props;
public Group[] groups;

public override string ToString()
{
Expand Down Expand Up @@ -49,6 +50,11 @@ public void DeleteProp(string key)
prop.value = null;

Talo.Players.Update();
}

public bool IsInGroup(string groupId)
{
return groups.Any((group) => group.id == groupId);
}
}
}
13 changes: 10 additions & 3 deletions Packages/com.trytalo.talo/Runtime/PlayersAPI.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,14 @@ public async Task Identify(string service, string identifier)

Talo.CurrentAlias = res.alias;

await Talo.Saves.GetSaves();
try
{
await Talo.Saves.GetSaves();
}
catch (Exception err)
{
Debug.LogError(err.Message);
}
}

public async void Update()
Expand All @@ -31,10 +38,10 @@ public async void Update()
Talo.CurrentPlayer = res.player;
}

public async Task<Player> Merge(string alias1, string alias2)
public async Task<Player> Merge(string playerId1, string playerId2)
{
var uri = new Uri(baseUrl + "/merge");
string content = JsonUtility.ToJson(new PlayersMergeRequest(alias1, alias2));
string content = JsonUtility.ToJson(new PlayersMergeRequest(playerId1, playerId2));

string json = await Call(uri, "POST", content);
var res = JsonUtility.FromJson<PlayersUpdateResponse>(json);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
using System.Collections;
using UnityEngine;

public class PlayersMergeRequest
public class PlayersMergeRequest
{
public string alias1, alias2;
public string playerId1, playerId2;

public PlayersMergeRequest(string alias1, string alias2)
public PlayersMergeRequest(string playerId1, string playerId2)
{
this.alias1 = alias1;
this.alias2 = alias2;
this.playerId1 = playerId1;
this.playerId2 = playerId2;
}
}
2 changes: 1 addition & 1 deletion Packages/com.trytalo.talo/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "com.trytalo.talo",
"version": "0.9.0",
"version": "0.10.0",
"displayName": "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 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",
"unity": "2019.1",
Expand Down
2 changes: 1 addition & 1 deletion Packages/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"com.unity.ide.visualstudio": "2.0.15",
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.vscode": "1.2.5",
"com.unity.test-framework": "1.1.31",
"com.unity.ugui": "1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.15",
"version": "2.0.16",
"depth": 0,
"source": "registry",
"dependencies": {
Expand Down
4 changes: 2 additions & 2 deletions ProjectSettings/ProjectVersion.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
m_EditorVersion: 2021.3.1f1
m_EditorVersionWithRevision: 2021.3.1f1 (3b70a0754835)
m_EditorVersion: 2021.3.11f1
m_EditorVersionWithRevision: 2021.3.11f1 (0a5ca18544bf)