Esempio n. 1
0
        // Header: 9
        public void SendId(int uniqueId, int sendCode, int fromCode, int customCode,
                           Dictionary <Socket, MasterNetworkPlayer> sockets)
        {
            var id = ByteParser.ConvertObjectToBytes(uniqueId);

            SendFinal(id, 9, sendCode, fromCode, customCode, sockets);
        }
Esempio n. 2
0
        // Header: 20
        public void SendString(string text, int sendCode, int fromCode, int customCode,
                               Dictionary <Socket, MasterNetworkPlayer> sockets)
        {
            var data = ByteParser.ConvertObjectToBytes(text);

            SendFinal(data, 20, sendCode, fromCode, customCode, sockets);
        }
Esempio n. 3
0
        // Header: 7
        public void SendInfoMessage(Socket sockets, string message, int target)
        {
            var  data         = ByteParser.ConvertObjectToBytes(message);
            byte headerByte   = 7;
            var  sendCodeByte = (byte)target;

            var newData = new byte[data.Length + 5];

            for (var i = 0; i < data.Length; i++)
            {
                newData[i + 5] = data[i];
            }
            newData[0] = headerByte;
            newData[1] = sendCodeByte;

            var customCodeByte = BitConverter.GetBytes(data.Length);

            newData[3] = customCodeByte[0];
            newData[4] = customCodeByte[1];

            sockets.BeginSend(newData, 0, newData.Length, SocketFlags.None, SendCallback, sockets);
        }
Esempio n. 4
0
 // Header: 50
 public void CreateGameObject(NetworkObjectData data, Socket socket)
 {
     byte[] byteData = ByteParser.ConvertObjectToBytes(data);
     SendFinal(byteData, 50, 2, data.fromId, 0, socket);
 }