示例#1
0
        static void DispatchPacket(MessageRecvData recv)
        {
            Debug.Log("Receive MessageID:" + recv.MsgID);
            MessageCallbackData d = null;

            if (m_MessageDispatchs.TryGetValue(recv.MsgID, out d))
            {
                d.Handler(recv);
            }
        }
示例#2
0
        public static void AddListener(MessageID id, NetworkCallback handle, object target)
        {
            MessageCallbackData d = null;

            if (m_MessageDispatchs.TryGetValue(id, out d))
            {
                d.Handler = handle;
                d.Target  = target;
                d.ID      = id;
            }
            else
            {
                d = new MessageCallbackData();
                m_MessageDispatchs[id] = d;
            }
        }