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) { } }
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); }
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) { } }
public Camera(Space game) : base(game) { }