Beispiel #1
0
 /// <summary>
 /// Constructor de Room.
 /// </summary>
 /// <param name="idRoom">Número de la sala.</param>
 /// <param name="name">Nombre del host.</param>
 /// <param name="host">Host de la sala.</param>
 public Room(int idRoom, string name, Client host)
 {
     IdRoom = idRoom;
     WaitingRoomFinished = false;
     GameFinished        = false;
     Clients.Add(name, host);
     PlayersNames.Add(name);
     HostName = name;
 }
Beispiel #2
0
        public int AddPlayer(string name, string databaseId)
        {
            if (IsRoomFull())
            {
                throw new InvalidOperationException("Room is full");
            }

            PlayersNames.Add(name);
            PlayerDatabaseId.Add(databaseId);

            Random random          = new System.Random();
            int    playerSecretKey = random.GetHashCode();

            RoomPlayersKeys.Add(playerSecretKey);

            return(playerSecretKey);
        }
Beispiel #3
0
 /// <summary>
 /// Añade un jugador a la sala.
 /// </summary>
 /// <param name="name">Nombre del jugador.</param>
 /// <param name="client">Cliente del jugador.</param>
 public void addCliente(string name, Client client)
 {
     PlayersNames.Add(name);
     Clients.Add(name, client);
 }