Exemplo n.º 1
0
 void GameUpdate()
 {
     //Console.WriteLine("GameUpdate");
     Protocol.ProtocolBytes proto = new Protocol.ProtocolBytes();
     proto.AddString("GameUpdate");
     proto.AddInt(m_currentFrame);
     lock (m_players)
     {
         for (int i = 0; i < m_players.Count; i++)
         {
             var player = m_players[i];
             proto.AddInt(player.curInput);
             m_inputs[player].Add(m_currentFrame, player.curInput);
         }
         Broadcast(proto);
     }
     m_currentFrame++;
 }
Exemplo n.º 2
0
 private void CreateMatch()
 {
     Console.WriteLine("room " + this.id + " CreateMatch");
     foreach (var p in m_players)
     {
         m_gameLoadProgress.Add(p, 0);
     }
     Protocol.ProtocolBytes proto = new Protocol.ProtocolBytes();
     proto.AddString("MatchCreate");
     proto.AddInt(id);
     Broadcast(proto);
     this.status = RoomStatus.Loading;
     //listening to progress
     timer           = new System.Timers.Timer(1000);
     timer.Elapsed  += ListenLoadProgress;
     timer.AutoReset = false;
     timer.Enabled   = true;
 }