Пример #1
0
        public List <int> GetUsersGameRooms(int userId)
        {
            List <int>   gameIds  = new List <int>();
            List <IGame> allGames = _gameService.GetAllGames();

            if (allGames != null)
            {
                allGames.ForEach(game =>
                {
                    game.GetPlayersInRoom().ForEach(p =>
                    {
                        if (p.user.Id() == userId)
                        {
                            gameIds.Add(game.Id);
                        }
                    });
                    game.GetSpectetorInRoom().ForEach(s =>
                    {
                        if (s.user.Id() == userId)
                        {
                            gameIds.Add(game.Id);
                        }
                    });
                });
            }
            return(gameIds);
        }
Пример #2
0
        public List <int> GetAllGamesId()
        {
            var allGames = _gameService.GetAllGames();

            return(GamesToIds(allGames));
        }