Exemple #1
0
        public static void AddListener(object obj, string eventName, Delegate action)
        {
            if (obj == null)
            {
                return;
            }
            var batch = new EventBatchStatic(action, obj);

            if (!_eventBatchStaticDict.TryGetValue(eventName, out var batches))
            {
                batches = new List <EventBatchStatic>();
                _eventBatchStaticDict.Add(eventName, batches);
                batches.Add(batch);
            }
            else
            {
                if (batches.Contains(batch))
                {
                    Debug.LogError($"Duplicate Add found event name {eventName}");
                    return;
                }

                batches.Add(batch);
            }
        }
Exemple #2
0
 private static bool IsMatchToRemove(EventBatchStatic b)
 {
     return(cTarget == b._target && cDelegate == b._delegate);
 }