Пример #1
0
        /// <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);
        }
Пример #2
0
 /// <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);
 }
Пример #3
0
 /// <summary>
 /// 执行网络消息包指令
 /// </summary>
 public void Execute()
 {
     PacketHandler.OnReceive(NetState, PacketReader);
 }