/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="iLength"></param> /// <param name="bInGame"></param> /// <param name="onPacketReceive"></param> public PacketHandler(long iPacketID, long iLength, bool bInGame, PacketReceiveCallback onPacketReceive) { m_PacketID = iPacketID; m_Length = iLength; m_Ingame = bInGame; m_OnReceive = onPacketReceive; }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="iLength"></param> /// <param name="bInGame"></param> /// <param name="onPacketReceive"></param> public PacketHandler( long iPacketID, long iLength, bool bInGame, PacketReceiveCallback onPacketReceive ) { m_PacketID = iPacketID; m_Length = iLength; m_Ingame = bInGame; m_OnReceive = onPacketReceive; }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="priority"></param> /// <param name="taskType"></param> /// <param name="onPacketReceive"></param> internal PacketHandler(ushort iPacketID, PacketPriority priority, TaskType taskType, PacketReceiveCallback onPacketReceive) { m_PacketID = iPacketID; m_PacketPriority = priority; m_OnReceive = onPacketReceive; m_TaskType = taskType; }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="priority"></param> /// <param name="taskType"></param> /// <param name="onPacketReceive"></param> internal PacketHandler(ushort iPacketID, PacketPriority priority, TaskType taskType, PacketReceiveCallback onPacketReceive) { m_PacketID = iPacketID; m_PacketPriority = priority; m_OnReceive = onPacketReceive; m_TaskType = taskType; }
public void PacketHandlerConstructorTest() { long iPacketID = 0; // TODO: 初始化为适当的值 long iLength = 0; // TODO: 初始化为适当的值 bool bInGame = false; // TODO: 初始化为适当的值 PacketReceiveCallback onPacketReceive = null; // TODO: 初始化为适当的值 PacketHandler target = new PacketHandler(iPacketID, iLength, bInGame, onPacketReceive); Assert.Inconclusive("TODO: 实现用来验证目标的代码"); }
/// <summary> /// 注册数据包的处理调用者 /// 注意,如果存在相同的消息id,会进行调用方法的替换操作 /// </summary> /// <param name="iPacketID"></param> /// <param name="onPacketReceive"></param> public void Register(ushort iPacketID, PacketReceiveCallback onPacketReceive) { if (m_Handlers.ContainsKey(iPacketID)) { // 如果有注册相同的消息id,这里只是进行记录,并不干预运行 Logs.Warn("Msgid {0} is replace.", iPacketID); } m_Handlers[iPacketID] = new PacketHandler(iPacketID, PacketPriority.Normal, onPacketReceive); }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="iLength"></param> /// <param name="bInGame"></param> /// <param name="onPacketReceive"></param> internal PacketHandler(long iPacketID, long iMinLength, PacketPriority priority, PacketReceiveCallback onPacketReceive) { m_PacketID = iPacketID; m_MinLength = iMinLength; m_PacketPriority = priority; m_OnReceive = onPacketReceive; CallTimes = 0; ElapsedTicks = 0; }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="iLength"></param> /// <param name="bInGame"></param> /// <param name="onPacketReceive"></param> internal PacketHandler(long iPacketID, long iMinLength, PacketPriority priority, PacketReceiveCallback onPacketReceive) { m_PacketID = iPacketID; m_MinLength = iMinLength; m_PacketPriority = priority; m_OnReceive = onPacketReceive; CallTimes = 0; ElapsedTicks = 0; }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="priority"></param> /// <param name="onPacketReceive"></param> public void Register(ushort iPacketID, PacketPriority priority, PacketReceiveCallback onPacketReceive) { if (m_Handlers[iPacketID] != null) { Logs.Warn("Msgid {0} is replace.", iPacketID); } NetTaskProfile.GetNetTaskProfile(iPacketID); m_Handlers[iPacketID] = new PacketHandler(iPacketID, priority, onPacketReceive); }
public void RegisterTest() { BasePacketHandlers target = new BasePacketHandlers(); // TODO: 初始化为适当的值 long iPacketID = 0; // TODO: 初始化为适当的值 long iLength = 0; // TODO: 初始化为适当的值 bool bInGame = false; // TODO: 初始化为适当的值 PacketReceiveCallback onPacketReceive = null; // TODO: 初始化为适当的值 target.Register(iPacketID, iLength, bInGame, onPacketReceive); Assert.Inconclusive("无法验证不返回值的方法。"); }
public void LengthTest() { long iPacketID = 0; // TODO: 初始化为适当的值 long iLength = 0; // TODO: 初始化为适当的值 bool bInGame = false; // TODO: 初始化为适当的值 PacketReceiveCallback onPacketReceive = null; // TODO: 初始化为适当的值 PacketHandler target = new PacketHandler(iPacketID, iLength, bInGame, onPacketReceive); // TODO: 初始化为适当的值 long actual; actual = target.Length; Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> /// 注册数据包的处理调用者 /// 注意,如果存在相同的消息id,会进行调用方法的替换操作 /// </summary> /// <param name="iPacketID"></param> /// <param name="onPacketReceive"></param> public void Register(ushort iPacketID, PacketReceiveCallback onPacketReceive) { if (m_Handlers[iPacketID] != null) { // 如果有注册相同的消息id,这里只是进行记录,并不干预运行 Logs.Warn("Msgid {0} is replace.", iPacketID); } // 这里在初始化的时候就把对应的性能监视的对象给创建好 NetTaskProfile.GetNetTaskProfile(iPacketID); m_Handlers[iPacketID] = new PacketHandler(iPacketID, PacketPriority.Normal, onPacketReceive); }
/// <summary> /// 任务类型 /// </summary> /// <param name="iPacketID"></param> /// <param name="taskType"></param> /// <param name="onPacketReceive"></param> public void Register(ushort iPacketID, TaskType taskType, PacketReceiveCallback onPacketReceive) { if (m_Handlers[iPacketID] != null) { // 如果有注册相同的消息id,这里只是进行记录,并不干预运行 Logs.Warn("Msgid {0} is replace.", iPacketID); } // 这里在初始化的时候就把对应的性能监视的对象给创建好 NetTaskProfile.GetNetTaskProfile(iPacketID); m_Handlers[iPacketID] = new PacketHandler(iPacketID, PacketPriority.Normal, taskType, onPacketReceive); }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="priority"></param> /// <param name="onPacketReceive"></param> public void Register(ushort iPacketID, PacketPriority priority, PacketReceiveCallback onPacketReceive) { if (m_Handlers[iPacketID] != null) { Logs.Warn("Msgid {0} is replace.", iPacketID); } NetTaskProfile.GetNetTaskProfile(iPacketID); m_Handlers[iPacketID] = new PacketHandler(iPacketID, priority, onPacketReceive); }
/// <summary> /// /// </summary> /// <param name="iPacketID"></param> /// <param name="priority"></param> /// <param name="onPacketReceive"></param> public void Register(ushort iPacketID, PacketPriority priority, PacketReceiveCallback onPacketReceive) { m_Handlers[iPacketID] = new PacketHandler(iPacketID, priority, onPacketReceive); }
public void Register( long iPacketID, long iLength, bool bInGame, PacketReceiveCallback onPacketReceive ) { m_Handlers.Add( iPacketID, new PacketHandler( iPacketID, iLength, bInGame, onPacketReceive ) ); }
/// <summary> /// 注册数据包的处理调用者 /// 注意,如果存在相同的消息id,会进行调用方法的替换操作 /// </summary> /// <param name="iPacketID"></param> /// <param name="onPacketReceive"></param> public void Register(ushort iPacketID, PacketReceiveCallback onPacketReceive) { if (m_Handlers[iPacketID] != null) { // 如果有注册相同的消息id,这里只是进行记录,并不干预运行 Logs.Warn("Msgid {0} is replace.", iPacketID); } m_Handlers[iPacketID] = new PacketHandler(iPacketID, PacketPriority.Normal, onPacketReceive); }
public void Register(long iPacketID, long iLength, bool bInGame, PacketReceiveCallback onPacketReceive) { m_Handlers.Add(iPacketID, new PacketHandler(iPacketID, iLength, bInGame, onPacketReceive)); }
public void Register(ushort iPacketID, PacketReceiveCallback onPacketReceive) { m_Handlers[iPacketID] = new PacketHandler(iPacketID, 0, PacketPriority.Normal, onPacketReceive); }
private void Server_ClientRecv(Server server, Client client, Packet packet) { PacketReceiveCallback?.Invoke(packet.Buffer); }
public void Register(ushort iPacketID, long iMinLength, PacketPriority priority, PacketReceiveCallback onPacketReceive) { m_Handlers[iPacketID] = new PacketHandler(iPacketID, iMinLength, priority, onPacketReceive); }