示例#1
0
 public void LobbyConnect()
 {
     using Lobby lobby = new Lobby();
     using RpcClientWithType <EmptyPlayerExecutor, ILobbyToPlayer, IPlayerToLobby>
           player1 = new RpcClientWithType <EmptyPlayerExecutor, ILobbyToPlayer, IPlayerToLobby>(),
           player2 = new RpcClientWithType <EmptyPlayerExecutor, ILobbyToPlayer, IPlayerToLobby>();
     lobby.Start(10001, 10002);
     player1.StartAsync(LocalHost, 10001).Wait();
     player2.StartAsync(LocalHost, 10001).Wait();
 }
示例#2
0
        public void LobbyRun()
        {
            using Lobby lobby = new Lobby();
            using RpcClientWithType <PlayerExecutor, ILobbyToPlayer, IPlayerToLobby>
                  player1 = new RpcClientWithType <PlayerExecutor, ILobbyToPlayer, IPlayerToLobby>(),
                  player2 = new RpcClientWithType <PlayerExecutor, ILobbyToPlayer, IPlayerToLobby>();
            using var evt = new ManualResetEvent(false);
            this.evt      = evt;

            lobby.Start(10001, 10002);
            player1.StartAsync(LocalHost, 10001).Wait();
            evt.WaitOne();
            evt.Reset();
            player2.StartAsync(LocalHost, 10001).Wait();
            evt.WaitOne();
            evt.Reset();
        }