コード例 #1
0
        private void LobbyHeartBeatResponse(byte[] bytes, IPEndPoint refEp)
        {
            LobbyHeartbeatConv conv = ConversationFactory.Instance
                                      .CreateFromMessage <LobbyHeartbeatConv>(bytes, refEp, null, null, null);

            conv.Start();
        }
コード例 #2
0
        private void SendButton_Click(object sender, EventArgs e)
        {
            //gets the address, port, and message to be sent from the textfields
            IPEndPoint         playerIP = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 1024);
            LobbyHeartbeatConv conv     =
                ConversationFactory.Instance
                .CreateFromConversationType <LobbyHeartbeatConv>
                    (playerIP, null, null, null);

            conv._NumberOfPlayers = 3;
            Thread convThread = new Thread(conv.Execute);

            convThread.Start();
        }
コード例 #3
0
ファイル: Lobby.cs プロジェクト: aaronlamchops/project-sushi
 public void SendHeartbeats()//run as seperate thread
 {
     while (isRunning)
     {
         //hearbeat to all players that have joined games
         foreach (var keypair in gameList)
         {
             GameInfo g = keypair.Value;
             int      numberOfPlayers = g.playerList.Count;
             foreach (Player p in g.playerList)
             {
                 IPEndPoint         playerIP = p.GetIP();
                 LobbyHeartbeatConv conv     =
                     ConversationFactory.Instance
                     .CreateFromConversationType <LobbyHeartbeatConv>
                         (playerIP, null, null, null);
                 conv._NumberOfPlayers = numberOfPlayers;
                 Thread convThread = new Thread(conv.Execute);
                 convThread.Start();
                 //If timeout, remove player from game
             }
         }
     }
 }