Ejemplo n.º 1
0
        protected void CleanUp(int roomId)
        {
            List <IGame> games = GameBridge.GetAllGames();

            foreach (IGame game in games)
            {
                if (game.Id == roomId)
                {
                    foreach (Player p in game.GetPlayersInRoom())
                    {
                        UserBridge.RemoveUserFromRoom(p.user.Id(), game.Id);
                        UserBridge.DeleteUser(p.user.MemberName(), p.user.Password());
                    }
                    foreach (Spectetor s in game.GetSpectetorInRoom())
                    {
                        UserBridge.RemoveSpectatorFromRoom(s.user.Id(), game.Id);
                        UserBridge.DeleteUser(s.user.MemberName(), s.user.Password());
                    }

                    bool deleted = GameBridge.RemoveRoom(roomId);
                    Console.WriteLine("room " + roomId + " was deleted? " + deleted);
                }
            }
        }