private void LoadLobbies(LobbyCollection lobbies) { if (lobbies.Count == 0) { _skinDefinition.Lobbies = new LobbyCollectionViewModel(Constants.DefaultNumberOfLobbyItems, _skinDefinition.Triggers); } else { _skinDefinition.Lobbies = new LobbyCollectionViewModel(lobbies.First().Items.Count, _skinDefinition.Triggers); } foreach (var lobby in lobbies) { var lobbyViewModel = new LobbyViewModel(new PlayerStatusTypeViewModel(PlayerStatusType.FromId(lobby.PlayerStatus), _skinDefinition.Triggers), lobby.FavoriteSize); foreach (var item in lobby.Items) { var itemViewModel = FindLobbyItemSource(item.Id); if (itemViewModel != null) { lobbyViewModel.Items.Add(new LobbyItemViewModel(itemViewModel)); } else { _buildErrors.Add(new ErrorMessageViewModel("Lobby arena", $"Cannot find the lobby item {item.Id} in the list of available lobby items", ErrorServerity.Warning, null)); } } _skinDefinition.Lobbies.Add(lobbyViewModel); } }
private Lobby BuildLobby(LobbyViewModel lobbyViewModel) { var lobby = new Lobby(lobbyViewModel.FavoritesSize, lobbyViewModel.PlayerStatus.Id); foreach (var lobbyItemViewModel in lobbyViewModel.Items) { lobby.Items.Add(new LobbyItem(lobbyItemViewModel.Id, lobbyItemViewModel.ShouldShowJackpot(lobbyViewModel.PlayerStatus))); } return(lobby); }