コード例 #1
0
ファイル: Program.cs プロジェクト: corefan/yad2
 static void Main(string[] args)
 {
     _sm          = new ServerMain();
     _clients     = new ClientConn[clientNo];
     _askCounters = new TurnAskTimeCounter[clientNo];
     for (int i = 0; i < clientNo; ++i)
     {
         _clients[i] = new ClientConn();
         _clients[i].InitConnection("127.0.0.1", 1734);
         _askCounters[i]             = new TurnAskTimeCounter();
         _clients[i].MessageSend    += new MessageEventHandler(_askCounters[i].OnMessageSend);
         _clients[i].MessageReceive += new MessageEventHandler(_askCounters[i].OnMessageRecieve);
         InitSend(i);
     }
     _clients[0].SendMessage(CreateCreateGameMessage());
     for (int i = 1; i < clientNo; ++i)
     {
         _clients[i].SendMessage(CreateJoinMessage());
     }
     Thread.Sleep(1000);
     for (int i = 0; i < clientNo; ++i)
     {
         _clients[i].SendMessage(MessageFactory.Create(MessageType.StartGame));
     }
     for (int i = 0; i < clientNo; ++i)
     {
         ClientSendingThread cst = new ClientSendingThread(_clients[i]);
         Thread th = new Thread(new ThreadStart(cst.ThreadProcess));
         th.Start();
     }
 }
コード例 #2
0
ファイル: Program.cs プロジェクト: corefan/yad2
 public ClientSendingThread(ClientConn conn)
 {
     cc = conn;
 }