示例#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;
        }
示例#2
0
 public TestGUI(Server server)
 {
     UserAccount owner = new UserAccount("TestUser", 0);
     String connString = server.joinGame("TestGame");
     Assert.AreEqual("http://localhost/Game/TestGame", connString);
     WCFConnectionFactory factory = new WCFTCPConnectionFactory();
     gameWindow = new GameWindow(owner, connString, this,factory);
 }