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); } }
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; } }