Example #1
0
        public static void MainX(string[] args)
        {
            ServiceHost service = new ServiceHost(NetworkInput.Instance);

            ServiceEndpoint endpoint = service.AddServiceEndpoint(
                typeof(XnaSpace.Input.INetworkInputService),
                new NetTcpBinding(),
                args[0]);
            Console.WriteLine(endpoint.ListenUri);
            service.Open();
            Console.WriteLine("Create Another");
            Console.ReadLine();
            Binding binding = new NetTcpBinding();
            EndpointAddress endpointAddress = new EndpointAddress(args[1]);
            NetworkClient client = new NetworkClient(binding, endpointAddress);
            client.Open();
            using (Space game = new Space(client))
            {
                game.Run();
            }
            try
            {
                client.Close();
                service.Close();
            }
            catch (Exception)
            {
            }
        }
Example #2
0
 public Background(Space game, ContentManager content, IInputManager input)
     : base(game)
 {
     this.content = content;
     DrawOrder = 1;
     input.OnMoveUp += new GameEventHandler(OnMoveUp);
     input.OnMoveDown += new GameEventHandler(OnMoveDown);
     input.OnMoveLeft += new GameEventHandler(OnMoveLeft);
     input.OnMoveRight += new GameEventHandler(OnMoveRight);
     input.OnTiltLeft += new GameEventHandler(OnTiltLeft);
     input.OnTiltRight += new GameEventHandler(OnTiltRight);
 }
Example #3
0
        void StartNetwork()
        {
            Config config = new Config();
            ServiceHost service = new ServiceHost(NetworkInput.Instance);
            service.AddServiceEndpoint(
                typeof(XnaSpace.Input.INetworkInputService),
                new NetTcpBinding(),
                config.PlayerEndpoint);
            service.Open();
            Binding binding = new NetTcpBinding();
            EndpointAddress endpointAddress = new EndpointAddress(config.EnemyEndpoint);
            NetworkClient client = new NetworkClient(binding, endpointAddress);
            int tries = 50;

            while (0 != tries)
            {
                try
                {
                    client.Open();
                    break;
                }
                catch (Exception)
                {
                    Thread.Sleep(1000);
                }
                --tries;
            }

            using (Space game = new Space(client))
            {
                game.Run();
            }
            try
            {
                client.Close();
                service.Close();
            }
            catch (Exception)
            {
            }
        }
Example #4
0
 public Camera(Space game)
     : base(game)
 {
 }