示例#1
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);
        }
    }
示例#2
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;
    }