public int GetPlayerRoomId(int playerkey) { int id = -1; id = RoomPlayersKeys.FindIndex(k => k == playerkey); return(id); }
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); }