public void DisplayRoomList(Lobby lobby) { for (int i = 0; i < lobby.LobbyData.Count; i++) { GameObject roomGORef = Instantiate(roomGO, roomGOParent, false); JoinRoom joinRoom = roomGORef.GetComponent <JoinRoom>(); joinRoom.Initialise(lobby.LobbyData[i]); roomInfoDic.Add(lobby.LobbyData[i].RoomId, joinRoom); } }
void RemoveRoom(Room room) { if (roomInfoDic.ContainsKey(room.RoomId)) { JoinRoom joinRoom = roomInfoDic[room.RoomId]; Destroy(joinRoom.gameObject); roomInfoDic.Remove(room.RoomId); } else { Debug.LogError("No rooms found to remove with name " + room.RoomName + " with key: " + room.RoomId); } }
void AddNewRoom(Room room) { if (roomInfoDic.ContainsKey(room.RoomId)) { Debug.LogError("Already containing room id for room: " + room.RoomName + " with key: " + room.RoomId); } else { GameObject roomGORef = Instantiate(roomGO, roomGOParent, false); JoinRoom joinRoom = roomGORef.GetComponent <JoinRoom>(); joinRoom.Initialise(room); roomInfoDic.Add(room.RoomId, joinRoom); } }