//Finally we pass the player and room information in the player_status. Adding the playerStatus (external call) //83: gettting 5 levels for a specific room (room_levels table). The first one is set true. // We create a playerStatus for one person when is on a room. Every player_status on every room_level. He is assigned to all all the room_levels (98) //The first is starting point true and the rest is created for the player based on the room_levels. //Iterating over 5 times and the the room_level index is passed in the objects and the first element (level 1->unlocked) for a player is set to true because of the starting point. public void CreatePlayerStatusForARoom(Player player, Room room) { using (Player_statusRepository player_statusRepository = new Player_statusRepository("DefaultConnection")) { List <Room_levels> room_levels = Room_LevelsLogic.getRoomLevels(room.ID); for (int i = 0; i < room_levels.Count(); i++) { Room_levels room_level = room_levels[i]; Player_Status player_status = new Player_Status(); if (i == 0) { player_status.IsUnlocked = true; } player_status.Player = player; player_status.Room_levels = room_level; addPlayerStatus(player_status); } } }
//Getting the room by searching the ID public Room getRoom(int id) { using (RoomRepository roomRepository = new RoomRepository("DefaultConnection")) { Room room = roomRepository.findOneRoom(id); room.Section = sectionLogic.findOneSection(room.SectionID); room.Levels = room_LevelsLogic.getRoomLevels(id); return(room); } }