Ejemplo n.º 1
0
 /// <summary>
 /// 接受消息时的外部方法,读取流对象取数据
 /// 子类无需重写
 /// </summary>
 public void OnRecv(int contentLen, ref LusuoStream ls)
 {
     eno         = ls.ReadInt();
     structBytes = new byte[contentLen - StringHelper.s_ShortSize - StringHelper.s_IntSize];
     ls.Read(ref structBytes);
     //Debug.Log("消息:" + msgID + " eno:" + eno);
 }
Ejemplo n.º 2
0
        private void InitStaticData()
        {
            if (m_staticDynamic == null)
            {
                return;
            }
            byte[]      data = m_staticDynamic.GetData();
            LusuoStream ls   = new LusuoStream(data);

            m_width      = ls.ReadInt();
            m_hight      = ls.ReadInt();
            m_staticData = new byte[m_width * m_hight];
            ls.Read(ref m_staticData);
        }
Ejemplo n.º 3
0
        private void _HandleMsgNew()
        {
            for (int i = 0; i < _m_listMsg.Count; i++)
            {
                LusuoStream stream = _m_listMsg[i];
                int         msgLen = stream.ReadInt();
                //ushort msgId = stream.ReadUShort();
                int msgId = stream.ReadInt();
                //Debug.Log("接受消息长度:" + msgLen);
                //Debug.Log("接受消息ID:" + (eNetMessageID)msgId);
                byte[] structBytes = new byte[msgLen - StringHelper.s_IntSize];
                stream.Read(ref structBytes);
                //MyMessage recv = ProtobufHelper.DeSerialize<MyMessage>(structBytes);

                //Action<MyMessage> OnRecv;
                //if (_m_msgList.TryGetValue(msgId, out OnRecv))
                //{
                //    if (OnRecv != null)
                //        OnRecv(recv);
                //}
            }
            _m_listMsg.Clear();
        }
Ejemplo n.º 4
0
 /// <summary>
 /// 接受消息时的外部方法,读取流对象取数据
 /// 子类无需重写
 /// </summary>
 public void OnRecv(ref Conn conn, int contentLen, ref LusuoStream ls)
 {
     eno         = ls.ReadInt();
     structBytes = new byte[contentLen - StringHelper.s_ShortSize - StringHelper.s_IntSize];
     ls.Read(ref structBytes);
 }