Example #1
0
        public EventHandlerListData GetEventHandlerList(short type, bool autoCreate = true)
        {
            if (!_eventHandlerDic.TryGetValue(type, out var eventList) && autoCreate)
            {
                eventList = new EventHandlerListData(type);
                _eventHandlerDic.Add(type, eventList);
            }

            return(eventList);
        }
Example #2
0
        private EventHandlerListData GetEventHandlerList(Dictionary <short, EventHandlerListData> dic, short type,
                                                         bool autoCreate)
        {
            if (dic.TryGetValue(type, out var eventList))
            {
                return(eventList);
            }

            if (autoCreate)
            {
                eventList = new EventHandlerListData(type);
                dic.Add(type, eventList);
                return(eventList);
            }

            return(null);
        }