diff --git a/Assets/Scripts/DatabaseClasses/Player.cs b/Assets/Scripts/DatabaseClasses/Player.cs
index e66b376..60657d9 100644
--- a/Assets/Scripts/DatabaseClasses/Player.cs
+++ b/Assets/Scripts/DatabaseClasses/Player.cs
@@ -9,10 +9,17 @@ public class Player
public string name;
public string id;
+ [JsonConstructor]
+ public Player(string _name, string _id)
+ {
+ name = _name;
+ id = _id;
+ }
+
public Player(string _name)
{
id = Guid.NewGuid().ToString();
- SetName( _name);
+ SetName(_name);
}
///
diff --git a/Assets/Scripts/RoomManager.cs b/Assets/Scripts/RoomManager.cs
index aef4f77..5693d9a 100644
--- a/Assets/Scripts/RoomManager.cs
+++ b/Assets/Scripts/RoomManager.cs
@@ -84,11 +84,13 @@ private void Initialize()
///
private void WhichCodesAreAlreadyUsed(Action> callback_OnCodesChecked)
{
+ Debug.Log("Checking other rooms to get which codes are already used", this);
List alreadyUsedCodes = new List();
try
{
realtimeDB.Child("rooms").GetValueAsync().ContinueWithOnMainThread(task =>
{
+ Debug.Log("looking into the online rooms", this);
if (task.IsFaulted)
{
Debug.LogException(task.Exception);
@@ -96,10 +98,13 @@ private void WhichCodesAreAlreadyUsed(Action> callback_OnCodesChecked)
else if (task.IsCompleted)
{
DataSnapshot snapshot = task.Result;
+ Debug.Log(snapshot.Value);
if (snapshot.Value != null)
{
- List onlineRooms = JsonConvert.DeserializeObject>(snapshot.GetRawJsonValue());
- foreach (Room r in onlineRooms)
+ string JSON = snapshot.GetRawJsonValue();
+ Debug.Log($"found some rooms :\n{JSON}", this);
+ Dictionary onlineRooms = JsonConvert.DeserializeObject>(JSON);
+ foreach (Room r in onlineRooms.Values)
{
Debug.Log($"Code {r.code} is already used by another party", this);
alreadyUsedCodes.Add(int.Parse(r.code));