public GameServer(NetworkServer networkServer, GameServerMessageRouter <TPlayer> router) { ThreadChecker.AssertMainThread(); this.clientAcceptor = new GameServerClientAcceptor <TPlayer>() { listener = this }; this.networkServer = networkServer; this.networkServer.listener = this; this._playerCollection = new PlayerCollection <int, TPlayer>(); this.pingController = new GameServerPingController <TPlayer>(this._playerCollection); this.router = router; this.router.Configure(this); }
/// <summary> /// Adds the listener. /// </summary> /// <param name="listener">The listener.</param> public void AddListener(IGameServerListener listener) { this.listeners.Add(listener); listener.PlayerConnected += this.OnPlayerConnected; }