add serverclients to lobby
This commit is contained in:
@@ -115,6 +115,7 @@ namespace Server.Models
|
|||||||
break;
|
break;
|
||||||
case 0x04:
|
case 0x04:
|
||||||
// canvas data
|
// canvas data
|
||||||
|
// todo send canvas data to all other serverclients in lobby
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Debug.WriteLine("[SERVER] Received weird identifier: " + id);
|
Debug.WriteLine("[SERVER] Received weird identifier: " + id);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ namespace Server.Models
|
|||||||
public bool Started = false;
|
public bool Started = false;
|
||||||
public List<Lobby> lobbies;
|
public List<Lobby> lobbies;
|
||||||
private Dictionary<Lobby, List<ServerClient>> serverClientsInlobbies;
|
private Dictionary<Lobby, List<ServerClient>> serverClientsInlobbies;
|
||||||
public int ClientsConnected { get; set; }
|
|
||||||
public Action newClientAction;
|
public Action newClientAction;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -34,7 +33,6 @@ namespace Server.Models
|
|||||||
serverClients = new List<ServerClient>();
|
serverClients = new List<ServerClient>();
|
||||||
lobbies = new List<Lobby>();
|
lobbies = new List<Lobby>();
|
||||||
serverClientsInlobbies = new Dictionary<Lobby, List<ServerClient>>();
|
serverClientsInlobbies = new Dictionary<Lobby, List<ServerClient>>();
|
||||||
ClientsConnected = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -80,7 +78,6 @@ namespace Server.Models
|
|||||||
newClientAction.Invoke();
|
newClientAction.Invoke();
|
||||||
// create a new serverclient object and add it to the list
|
// create a new serverclient object and add it to the list
|
||||||
serverClients.Add(new ServerClient(tcpClient));
|
serverClients.Add(new ServerClient(tcpClient));
|
||||||
ClientsConnected++;
|
|
||||||
//start listening for new tcp clients
|
//start listening for new tcp clients
|
||||||
listener.BeginAcceptTcpClient(new AsyncCallback(OnClientConnected), null);
|
listener.BeginAcceptTcpClient(new AsyncCallback(OnClientConnected), null);
|
||||||
}
|
}
|
||||||
@@ -133,7 +130,15 @@ namespace Server.Models
|
|||||||
// TODO send lobby full message
|
// TODO send lobby full message
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// TODO add serverclient to lobbies dict
|
foreach(ServerClient sc in serverClients)
|
||||||
|
{
|
||||||
|
if (sc.Username == username)
|
||||||
|
{
|
||||||
|
serverClientsInlobbies[l].Add(sc);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user