Example #1
0
        public void AddListener(string strEvent, EventsDelegate.EventFunction eventFunc)
        {
            if (eventFunc == null)
            {
                return;
            }

            if (!m_dictDelegate.ContainsKey(strEvent))
            {
                m_dictDelegate.Add(strEvent, new EventsDelegate());
            }

            if (!m_dictDelegate [strEvent].IsContain(eventFunc))
            {
                m_dictDelegate [strEvent].Add(eventFunc);
            }
        }
Example #2
0
        public void RemoveListener(string strEvent, EventsDelegate.EventFunction eventFunc)
        {
            if (eventFunc == null)
            {
                return;
            }

            if (!m_dictDelegate.ContainsKey(strEvent))
            {
                return;
            }

            EventsDelegate curDelegate = m_dictDelegate [strEvent];

            if (curDelegate == null)
            {
                return;
            }

            curDelegate.Remove(eventFunc);
        }