public void CreateRoom(Player player) { string possibleRoomCode = GameHelpCommands.RoomCodeGenerate(); bool codeIsPossible = false; while (!codeIsPossible) { if (this.server.RoomExists(possibleRoomCode)) { possibleRoomCode = GameHelpCommands.RoomCodeGenerate(); } codeIsPossible = true; } ServerRoom room = new ServerRoom(possibleRoomCode); Write($"Roomcode``{possibleRoomCode}~_~"); this.server.addRoom(room); room.AddPlayer(this.player); }
public void addRoom(ServerRoom room) { this.rooms.Add(room); }