예제 #1
0
 public static void SendPacket(NetworkProtol np, WfPacket pak)
 {
     pak.Swap();
     if (np == NetworkProtol.Tcp)
     {
         m_TcpNet.SendPacket(pak);
     }
     else if (np == NetworkProtol.Kcp)
     {
         //m_KcpNet.SendPacket(pak);
     }
 }
예제 #2
0
    public static void SendPacket(NetworkProtol np, ISerializePacket msg, ushort msgType)
    {
        WfPacket pak = PooledClassManager <WfPacket> .CreateClass();

        pak.InitWrite(msgType);
        msg.Serialize(pak);
        pak.Swap();
        if (np == NetworkProtol.Tcp)
        {
            SendPacket(np, pak);
        }
        else if (np == NetworkProtol.Kcp)
        {
            //WfPacket pak = new WfPacket(msgType, 548);
            SendPacket(np, pak);
        }
    }
예제 #3
0
    //自己给自己发消息,用于测试
    public static void SendPacketToMe(NetworkProtol np, ISerializePacket msg, ushort msgType)
    {
        WfPacket pak = PooledClassManager <WfPacket> .CreateClass();

        pak.InitWrite(msgType);
        msg.Serialize(pak);
        pak.Swap();
        if (np == NetworkProtol.Tcp)
        {
            GameDll.PacketHandlerManager.ProcessPacket(pak);
        }
        else if (np == NetworkProtol.Kcp)
        {
            //KCPPacketHandlerMgr.GetInstance().ProcessPacket(pak);
        }
        pak.DestroyClass();
        pak = null;
    }