public void Serialize(ByteProtocol protocol)
 {
     protocol.push(dic.Count);
     foreach (var kv in dic)
     {
         protocol.push(kv.key);
         protocol.push(kv.value);
     }
 }
        private void SendPingMsg()
        {
            m_dtLastPingTime = DateTime.Now;
            ProtocolBase protocol = new ByteProtocol();

            protocol.push((byte)MessageType.Ping);
            protocol.push((byte)ServerCon.clientId);
            this.Send(protocol.GetByteStream());
        }
 public void Serialize(ByteProtocol protocol)
 {
     protocol.push(assets.Count);
     foreach (var assetsData in assets)
     {
         assetsData.data.Serialize(protocol);
     }
     foreach (var assetsData in assets)
     {
         assetsData.Serialize(protocol);
     }
 }
Beispiel #4
0
        /// <summary>
        /// 发送本地客户端帧信息
        /// </summary>
        protected void SendClientFrame(object sender, ElapsedEventArgs e)
        {
            if (client.ServerCon.clientId < 0)
            {
                return;
            }
            ProtocolBase protocol = new ByteProtocol();

            protocol.push((byte)MessageType.Frame);
            protocol.push((byte)client.ServerCon.clientId);

            foreach (var bt in sendKey.GetBytes())
            {
                protocol.push(bt);
            }



            protocol.push((byte)joySticks.Count);
            // Debug.LogError("len"+joySticks.Count);
            foreach (var joy in joySticks)
            {
                //  Debug.LogError("key"+joy.Key);
                protocol.push((byte)joy.Key);
                protocol.push(joy.Value.direction);
            }

            client.Send(protocol.GetByteStream());
        }