public static void SetEnableDebug(NetworkProtol np, bool debug) { if (np == NetworkProtol.Tcp) { m_TcpNet.SetEnableDebug(debug); } }
public static bool GetEnableDebug(NetworkProtol np) { if (np == NetworkProtol.Tcp) { return(m_TcpNet.GetEnableDebug()); } return(false); }
public static void StartNetwork(NetworkProtol np) { if (np == NetworkProtol.Tcp) { m_TcpNet = new ClientNet(); } else if (np == NetworkProtol.Kcp) { //m_KcpNet = new KCPNet(); } }
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 int GetServerPort(NetworkProtol np) { if (np == NetworkProtol.Tcp) { return(m_TcpNet.GetServerPort()); } else if (np == NetworkProtol.Kcp) { return(0);// m_KcpNet.GetServerPort(); } return(0); }
public static string GetServerIP(NetworkProtol np) { if (np == NetworkProtol.Tcp) { return(m_TcpNet.GetServerIP()); } else if (np == NetworkProtol.Kcp) { return("");// m_KcpNet.GetServerIP(); } return(""); }
public static bool IsConnectState(NetworkProtol np, int state) { if (np == NetworkProtol.Tcp) { return(m_TcpNet != null && m_TcpNet.isConnectState(state)); } else if (np == NetworkProtol.Kcp) { return(false); // m_KcpNet != null && m_KcpNet.isConnectState(state); } return(false); }
public static bool IsNetRun(NetworkProtol np) { if (np == NetworkProtol.Tcp) { return(m_TcpNet != null && m_TcpNet.IsNetRun()); } else if (np == NetworkProtol.Kcp) { return(false); //m_KcpNet != null && m_KcpNet.IsNetRun(); } return(false); }
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 Shutdown(NetworkProtol np) { if (np == NetworkProtol.Tcp) { if (m_TcpNet != null) { m_TcpNet.Shutdown(); } } else if (np == NetworkProtol.Kcp) { //if(m_KcpNet!= null) //{ // m_KcpNet.Shutdown(); //} } }
//自己给自己发消息,用于测试 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; }