[FIX] fix users not being sent with lobbies
This commit is contained in:
@@ -110,8 +110,14 @@ namespace SharedClientServer
|
||||
{
|
||||
dynamic payload = JsonConvert.DeserializeObject(Encoding.ASCII.GetString(json));
|
||||
JArray lobbiesArray = payload.lobbies;
|
||||
Debug.WriteLine(lobbiesArray.ToString());
|
||||
return lobbiesArray.ToObject<Lobby[]>();
|
||||
Debug.WriteLine("[JSONCONVERT] got lobbies from message" + lobbiesArray.ToString());
|
||||
Lobby[] lobbiesTemp = lobbiesArray.ToObject<Lobby[]>();
|
||||
Debug.WriteLine("lobbies in array: ");
|
||||
foreach (Lobby l in lobbiesTemp)
|
||||
{
|
||||
Debug.WriteLine("players: " + l.PlayersIn);
|
||||
}
|
||||
return lobbiesTemp;
|
||||
}
|
||||
|
||||
public static int GetLobbyID(byte[] json)
|
||||
|
||||
@@ -68,12 +68,25 @@ namespace Client
|
||||
set { _playersIn = value; }
|
||||
}
|
||||
|
||||
public void Set(Lobby lobby)
|
||||
{
|
||||
this._id = lobby._id;
|
||||
this._users = lobby._users;
|
||||
this._maxPlayers = lobby._maxPlayers;
|
||||
}
|
||||
|
||||
public int MaxPlayers
|
||||
{
|
||||
get { return _maxPlayers; }
|
||||
set { _maxPlayers = value; }
|
||||
}
|
||||
|
||||
public List<User> Users
|
||||
{
|
||||
get { return _users; }
|
||||
set { _users = value; }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
@@ -10,6 +11,7 @@ namespace SharedClientServer
|
||||
private int _score;
|
||||
private bool _host;
|
||||
|
||||
[JsonConstructor]
|
||||
public User(string username, int score, bool host)
|
||||
{
|
||||
_username = username;
|
||||
|
||||
Reference in New Issue
Block a user