Ejemplo n.º 1
0
        public void AddNetWorkEchoMessage(NetWorkEchoMessageClient mes, bool originHandleMessageBack = false)
        {
            Debug.Assert(mes.HandleMessageBack != null);
            Debug.Assert(mes.CreateMessage != null);

            NetOutgoingMessage om = this.CreateMessage(NetMessageType.Echo);

            om.Write(mes.Identifier);
            if (!originHandleMessageBack)
            {
                om.Write((long)client.UniqueIdentifier);
            }
            else
            {
                om.Write((long)0);
            }
            SendMessage(mes.CreateMessage(om), NetDeliveryMethod.ReliableOrdered);
            NetWorkEcho[mes.Identifier] = mes;
        }
 void key_KeyStateChange2(InputPlayableKeyBoard ipk)
 {
     NetWorkEchoMessageClient c = new NetWorkEchoMessageClient("teste",
         (mes) =>
         {
             mes.Write("TESTE");
             return mes;
         }
     ,
     (mes) =>
     {
         ///server will change the message =P (just  a test ...)
         Debug.Assert(mes.ReadString() == "TESTE123");
     }
     );
     client.AddNetWorkEchoMessage(c,true);
 }
        public void AddNetWorkEchoMessage(NetWorkEchoMessageClient mes, bool originHandleMessageBack = false)
        {
            Debug.Assert(mes.HandleMessageBack != null);
            Debug.Assert(mes.CreateMessage != null);

            NetOutgoingMessage om = this.CreateMessage(NetMessageType.Echo);
            om.Write(mes.Identifier);
            if (!originHandleMessageBack)
            {
                om.Write((long)client.UniqueIdentifier);
            }
            else
            {
                om.Write((long)0);
            }
            SendMessage(mes.CreateMessage(om),NetDeliveryMethod.ReliableOrdered);
            NetWorkEcho[mes.Identifier] = mes;
        }