Custom names and time in chat
This commit is contained in:
10
Room/Room.cs
10
Room/Room.cs
@@ -20,9 +20,9 @@ public class Room
|
||||
_roomId = roomId;
|
||||
}
|
||||
|
||||
public async Task InstantiateConnection(WebSocket socket)
|
||||
public async Task InstantiateConnection(WebSocket socket, string name)
|
||||
{
|
||||
var connection = AddConnection(socket);
|
||||
var connection = AddConnection(socket, name);
|
||||
if (IsEmpty()) _host = connection;
|
||||
_game.AddPlayerToGame(connection);
|
||||
await HandleConnection(connection);
|
||||
@@ -45,7 +45,7 @@ public class Room
|
||||
}
|
||||
case "CHAT":
|
||||
{
|
||||
_chat.SendChatMessage(connection.ConnectionId, message.Payload);
|
||||
_chat.SendChatMessage(connection, message.Payload);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -57,10 +57,10 @@ public class Room
|
||||
HandleDisconnect(connection.ConnectionId);
|
||||
}
|
||||
|
||||
private ConnectionInstance AddConnection(WebSocket socket)
|
||||
private ConnectionInstance AddConnection(WebSocket socket, string name)
|
||||
{
|
||||
var connectionId = Guid.NewGuid().ToString();
|
||||
var connection = new ConnectionInstance(connectionId, socket);
|
||||
var connection = new ConnectionInstance(name, connectionId, socket);
|
||||
_connections.Add(connection);
|
||||
return connection;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user