Пример #1
0
        /// <summary>Creates a new client that can be used to join remote games.</summary>
        /// <param name="game">The game to create the client for.</param>
        /// <returns>A new client.</returns>
        public static IClientController <FrameCommand> CreateRemoteClient(Program game)
        {
            // Create actual controller.
            var controller = new SimpleClientController <Profile>(SpaceCommandHandler.HandleCommand);

            // Needed by some systems. Add all systems we need in our game as a client.
            AddSpaceServerSystems(controller.Simulation.Manager, game);
            AddSpaceClientSystems(controller.Simulation.Manager, game, controller.Session, controller);

            // Done.
            return(controller);
        }
Пример #2
0
        private static void RunSimpleVersion(ClientConfiguration clientConfig)
        {
            Console.WriteLine(
                "[{0}] Client {1} executing script {2} at {3} with simple version",
                DateTime.Now.ToString("HH:mm:ss"),
                clientConfig.Username,
                clientConfig.Script,
                clientConfig.Url);

            NamingService namingService = new NamingService(
                clientConfig.NamingServersUrls,
                SimpleGrpcMessageLayer.Instance);

            SimpleKVSMessageLayer.SetContext(namingService);

            SimpleClientController controller = new SimpleClientController(namingService);

            RunMainLoop(controller, clientConfig);
        }