コード例 #1
0
        /// <summary>
        /// Creates a new server listening on the specified port and allowing
        /// for the specified number of players.
        /// </summary>
        /// <param name="port">The port to listen on.</param>
        /// <param name="maxPlayers">The maximum number of players supported.</param>
        /// <param name="commandHandler">The command handler to use in the
        /// simulation.</param>
        public SimpleServerController(ushort port, int maxPlayers, CommandHandler commandHandler)
            : base(new HybridServerSession <TPlayerData>(port, maxPlayers))
        {
            var simulation = new DefaultSimulation();

            simulation.Command += commandHandler;
            Tss.Initialize(simulation);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new game client, ready to connect to an open game.
        /// </summary>
        /// <param name="commandHandler">The command handler to use.</param>
        public SimpleClientController(CommandHandler commandHandler)
            : base(new HybridClientSession <TPlayerData>())
        {
            var simulation = new DefaultSimulation();

            simulation.Command += commandHandler;
            Tss.Initialize(simulation);
        }