public Game(SetupPhase lobby)
 {
     if (lobby != null)
     {
         _phase = lobby;
     }
 }
        public Error CreateLobby(string userId, int slots, LobbyAccess access, out string gameId)
        {
            gameId = null;
            if (!access.IsDefined())
            {
                return(Error.Codes.E08InvalidLobbyAccessValue);
            }
            if (!Users.ContainsId(Id.Partial(userId)))
            {
                return(Error.Codes.E02UserNotFound, userId);
            }
            if (!GameLogic.SessionFactory.IsValid.PlayerCount(slots))
            {
                return(Error.Codes.E05InvalidSlotCount);
            }
            var lobby = new SetupPhase(userId, slots, access);
            var game  = new Game(lobby);

            gameId = Games.CreateGame(game).Encoded;
            return(Error.Codes.E00NoError);
        }