Ejemplo n.º 1
0
        /// <see cref="INetwork.CreateLobby"/>
        public ILobbyServer CreateLobby(int maxClients, ILobbyListener listener)
        {
            if (this.closed)
            {
                throw new ObjectDisposedException("Network");
            }
            if (maxClients < 1)
            {
                throw new ArgumentOutOfRangeException("maxClients");
            }
            if (listener == null)
            {
                throw new ArgumentNullException("listener");
            }

            if (this.localLobby == null && this.remoteLobby == null)
            {
                LobbyServer lobbyServer = CreateLocalLobby_i(maxClients, listener);
                lobbyServer.Disposed += this.LobbyDisposedHandler;
                this.localLobby       = lobbyServer;
                return(this.localLobby);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs a new lobby announcer object.
        /// </summary>
        /// <param name="lobby">The lobby that this object will announce.</param>
        /// <param name="customDataProvider">The object that provides additional informations to the announcement.</param>
        public LobbyAnnouncer(LobbyServer lobby, ILobbyCustomDataProvider customDataProvider)
        {
            if (lobby == null)
            {
                throw new NetworkingSystemException("lobby");
            }

            this.announcedLobby       = lobby;
            this.customDataProvider   = customDataProvider;
            this.announcerThread      = null;
            this.announcementFinished = null;
        }
Ejemplo n.º 3
0
        public LANLobbyAnnouncer(LobbyServer lobby, ILobbyCustomDataProvider customDataProvider, List <int> wellKnownBroadcastPorts)
            : base(lobby, customDataProvider)
        {
            if (wellKnownBroadcastPorts == null || wellKnownBroadcastPorts.Count == 0)
            {
                throw new ArgumentNullException("wellKnownBroadcastPorts");
            }

            this.wellKnownBroadcastPorts = new List <int>();
            foreach (int port in wellKnownBroadcastPorts)
            {
                this.wellKnownBroadcastPorts.Add(port);
            }
        }