Example #1
0
        public void UnReg <T>(string e, Action <string, T> handle)
        {
            IHandle ih = null;

            if (event_dics.TryGetValue(e, out ih))
            {
                if (ih is EventHandle <T> )
                {
                    EventHandle <T> i = ih as EventHandle <T>;
                    i.handle -= handle;
                }
            }
        }
Example #2
0
        public void Reg <T>(string e, Action <string, T> handle)
        {
            IHandle ih = null;

            if (event_dics.TryGetValue(e, out ih))
            {
                if (ih is EventHandle <T> )
                {
                    EventHandle <T> i = ih as EventHandle <T>;
                    i.handle += handle;
                }
                else
                {
                    Debug.LogError("same event name registed but the callback is not same that will have problem ,try remove one");
                    throw new System.Exception("same event name registed but the callback is not same that will have problem ,try remove one");
                }
            }
            else
            {
                event_dics.Add(e, new EventHandle <T>(e, handle));
            }
        }