Beispiel #1
0
 void sockA_sockEvent(object sender, sockEventArgs e)
 {
     try
     {
         if (sockA.clientSock.Connected)
         {
             byte[] bu;
             switch (e.cmd)
             {
                 case 0xBB:
                     bu = new byte[m.lado * m.lado + 3];
                     bu[0] = e.cmd;
                     bu[1] = e.us2;
                     bu[bu.Length - 1] = e.us1;
                     var gm = m.getMapa();
                     for (int i = 0; i < bu.Length - 3; i++)
                     {
                         bu[i + 2] = gm[i];
                     }
                     sockA.clientSock.Send(bu);
                     break;
                 case 0xDD:
                     bu = new byte[4];
                     bu[0] = e.cmd;
                     bu[1] = e.us2;
                     bu[2] = 5;
                     bu[3] = e.us1;
                     sockA.clientSock.Send(bu);
                     break;
                 case 0xFF://movimiento
                     bu = new byte[m.lado * m.lado + 3];
                     bu[0] = e.cmd;
                     bu[1] = e.us2;
                     bu[2] = 0x33;
                     bu[3] = e.us1;
                     sockA.clientSock.Send(bu);
                     //mover carro e.data
                     m.moverCarro(((Direccion)e.dat));
                     break;
                 default:
                     break;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #2
0
 // Invoke the Changed event; called whenever list changes
 protected virtual void OnsockAdmi(sockEventArgs e)
 {
     if (sockEvent != null)
         sockEvent(this, e);
 }