public void SetUp()
        {
            LocalNetworkConnectionHub hub = new LocalNetworkConnectionHub();

            factoryA = hub.CreateNodeFactory();
            factoryB = hub.CreateNodeFactory();
        }
Example #2
0
        public void SetUp()
        {
            LocalNetworkConnectionHub hub = new LocalNetworkConnectionHub();

            factory0 = hub.CreateNodeFactory();
            factory1 = hub.CreateNodeFactory();
            factory2 = hub.CreateNodeFactory();

            relay0 = new NetworkRelay <LocalNetworkConnection, int>(factory0, matchmakingFileId);
            relay1 = new NetworkRelay <LocalNetworkConnection, int>(factory1, matchmakingFileId);
            relay2 = new NetworkRelay <LocalNetworkConnection, int>(factory2, matchmakingFileId);
        }
Example #3
0
        private static void Main()
        {
            AppDomain currentDomain = AppDomain.CurrentDomain;

            currentDomain.UnhandledException += MyHandler;

            LocalNetworkConnectionHub hub = new LocalNetworkConnectionHub();

            LocalNetworkConnectionFactory factory0 = hub.CreateNodeFactory();
            LocalNetworkConnectionFactory factory1 = hub.CreateNodeFactory();

            INetworkRelay <int> relay0 = new NetworkRelay <LocalNetworkConnection, int>(factory0);
            INetworkRelay <int> relay1 = new NetworkRelay <LocalNetworkConnection, int>(factory1);

            relay0.CreateMatchmakingFile(MatchmakingFileId);
            relay1.CreateMatchmakingFile(MatchmakingFileId);

            relay0.CreateLeaderboardsFile(LeaderboardsFileId);
            relay1.CreateLeaderboardsFile(LeaderboardsFileId);

            relay0.ConnectToNodeAsync(1).Wait();

            Task.Delay(100).Wait();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            client0 = new FormMatchmaking <int>(relay0, MatchmakingFileId, LeaderboardsFileId);
            client1 = new FormMatchmaking <int>(relay1, MatchmakingFileId, LeaderboardsFileId);

            Task.Delay(100).Wait();

            var thread = new Thread(ThreadStart);

            thread.TrySetApartmentState(ApartmentState.STA);
            thread.Start();

            Application.Run(client0);
        }