Exemple #1
0
        protected override void MessageArrived(byte[] message)
        {
            //DLogger.WriteLineToScreen("Message Length: " + message.Length);
            if (message.Length >= 3)
            {
                char   c1  = Convert.ToChar(message[1]);
                char   c2  = Convert.ToChar(message[2]);
                string str = String.Format("1,2,3 bytes {0}, {1}, {2}", message[0], c1, c2);
                DLogger.WriteLineToScreen(str);
            }
            else
            {
                DLogger.WriteLineToScreen("Message error");
            }

            var type = NetworkCryptor.GetTypeOfMessage(message);


            if (type == NetworkCryptor.NetworkMessageType.InstanceCharacter)
            {
                var pi = NetworkCryptor.PlayerInstanceInfo.fromBytes(message);
                DLogger.WriteLineToScreen("Instance id: " + pi.id);
                gameAdmin.AddMessageToQueue(pi);
            }
            if (type == NetworkCryptor.NetworkMessageType.MoveTo)
            {
                var pi = NetworkCryptor.PlayerMoveToInfo.fromBytes(message);
                gameAdmin.AddMessageToQueue(pi);
            }
            if (type == NetworkCryptor.NetworkMessageType.DestroyInstance)
            {
                var pi = NetworkCryptor.PlayerDestroyInfo.fromBytes(message);
                gameAdmin.AddMessageToQueue(pi);
            }
        }
Exemple #2
0
 public static PlayerInstanceInfo fromBytes(byte[] b)
 {
     if (isThis(b))
     {
         var position = NetworkCryptor.ReadVector3f(ref b, 4);
         var pinf     = new PlayerInstanceInfo(b[3], position);
         return(pinf);
     }
     return(null);
 }
Exemple #3
0
        protected override void MessageArrived(byte[] message)
        {
            if (message.Length >= 3)
            {
                char   c1  = Convert.ToChar(message[1]);
                char   c2  = Convert.ToChar(message[2]);
                string str = String.Format("1,2,3 bytes {0}, {1}, {2}", message[0], c1, c2);
                DLogger.WriteLineToScreen(str);
            }
            else
            {
                DLogger.WriteLineToScreen("Message error");
            }
            var type = NetworkCryptor.GetTypeOfMessage(message);

            if (type == NetworkCryptor.NetworkMessageType.MoveTo)
            {
                server.SendMessageToClientNotOne(message, this);
            }
        }