Beispiel #1
0
        public static LobbyWindow lanGame(UserAccount account, ILobbyGUI gui)
        {
            DiscoveryClient dc = new DiscoveryClient(new UdpDiscoveryEndpoint());
            FindCriteria fc = new FindCriteria(typeof(IDiscoveryTest));
            fc.Duration = TimeSpan.FromSeconds(5);
            FindResponse fr = dc.Find(fc);

            if (fr.Endpoints.Count > 0)
            {
                ip = fr.Endpoints[0].Address.Uri.Host.ToString();
            }
            else
            {
                string HostName = System.Net.Dns.GetHostName();
                System.Net.IPHostEntry hostInfo = System.Net.Dns.GetHostByName(HostName);
                string IpAdresse = hostInfo.AddressList[0].ToString();
                ip = IpAdresse;
                Server server = new Server(new WCFTCPServiceFactory(),ip);
                server.run();
            }

            factory = new WCFTCPConnectionFactory();
            lobbyWindow = new LobbyWindow(account, gui, factory);
            factory.connectToLobby(ip, lobbyWindow);

            return lobbyWindow;
        }
Beispiel #2
0
        public static LobbyWindow onlineGame(UserAccount account, ILobbyGUI gui)
        {
            ip = "145.93.27.6";
            factory = new WCFHTTPConnectionFactory();
            lobbyWindow = new LobbyWindow(account, gui, factory);
            factory.connectToLobby(ip, lobbyWindow);

            return lobbyWindow;

        }
        public ILobby connectToLobby(string uri, LobbyWindow lobbyWindow)
        {
            uri = HTTP_CONN_STR + uri + "/" + LOBBY_NAME;
            DuplexChannelFactory<ILobby> httpDuplexFactory =
                new DuplexChannelFactory<ILobby>(
                    new LobbyCallback(lobbyWindow),
                    new WSDualHttpBinding(WSDualHttpSecurityMode.Message),
                    new EndpointAddress(
                        uri));

            return httpDuplexFactory.CreateChannel();
        }
        public ILobby connectToLobby(string uri, LobbyWindow lobbyWindow)
        {
            uri = TCP_CONN_STR + uri + "/" + LOBBY_NAME;
            DuplexChannelFactory<ILobby> tcpDuplexFactory =
                new DuplexChannelFactory<ILobby>(
                    new LobbyCallback(lobbyWindow),
                    new NetTcpBinding(SecurityMode.None),
                    new EndpointAddress(
                        uri));

            return tcpDuplexFactory.CreateChannel();
        }
Beispiel #5
0
 public void register(LobbyWindow window) 
 {
     lobby = window;
 }
Beispiel #6
0
 public LobbyCallback(LobbyWindow lobbyWindow)
 {
     this.lobbyWindow = lobbyWindow;  
 }
 public TestGUI()
 {
     UserAccount user = new UserAccount("testUser", 0);
     lobbyWindow = new LobbyWindow(user, this, new WCFTCPConnectionFactory());
     messageUpdated = 0;
     logUpdated = 0;
 }