Beispiel #1
0
        public static CustomPacket Create(Int16 protocolID)
        {
            //CustomPacket packet = new CustomPacket();
            CustomPacket packet = PacketBufferManager.Pop();

            packet.SetProtocol(protocolID);
            return(packet);
        }
Beispiel #2
0
        public void ParsePacket(CustomPacket packet)
        {
            PT packetProtocolID = (PT)packet.PopProtocalID();

            switch (packetProtocolID)
            {
            case PT.PT_CS_LOGIN_REQ:
                break;

            case PT.PT_CS_CHAT_REQ:
                CS_CHAT_REQ(packet);
                break;
            }
        }
Beispiel #3
0
        public void CS_CHAT_REQ(CustomPacket packet)
        {
            //string text = packet.PopString();
            //Console.WriteLine($"Chat : {text}");

            PT_CS_CHAT_REQ req = PacketData <PT_CS_CHAT_REQ> .Deserialize(packet.m_buffer);

            //CustomPacket ack = CustomPacket.Create((short)PT.PT_SC_CHAT_ACK);
            //ack.Push(text);
            PT_SC_CHAT_ACK ack = new PT_SC_CHAT_ACK();

            ack.chatType = 0;
            ack.chatStr  = req.chatStr;

            CustomPacket send = CustomPacket.Create((short)PT.PT_SC_CHAT_ACK);

            send.Push(ack.Serialize());

            m_token.SendPacket(send);
        }
Beispiel #4
0
 public void CopyTo(CustomPacket targetPacket)
 {
     targetPacket.SetProtocol(m_protocolID);
     targetPacket.Overwrite(m_buffer, m_position);
 }
Beispiel #5
0
 public static void Destory(CustomPacket packet)
 {
     PacketBufferManager.Push(packet);
 }