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); } }
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); } }
//自己给自己发消息,用于测试 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; }