public static void TriggerEvent(string eventName, object arg1, object arg2)
        {
            UnityTwoArgsEvent thisEvent = null;

            if (instance.eventTwoArgsDictionary != null && instance.eventTwoArgsDictionary.Count > 0 && instance.eventTwoArgsDictionary.ContainsKey(eventName) && instance.eventTwoArgsDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.Invoke(arg1, arg2);
            }
        }
예제 #2
0
        public static void TriggerEvent(string eventName, object arg1, object arg2)
        {
            UnityTwoArgsEvent thisEvent = null;

            if (instance.eventTwoArgsDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.Invoke(arg1, arg2); // Run all listener functions associated with this event.
            }
        }
        public static void StopListening(string eventName, UnityAction <object, object> listener)
        {
            if (eventManager == null)
            {
                return;
            }
            UnityTwoArgsEvent thisEvent = null;

            if (instance.eventTwoArgsDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.RemoveListener(listener);
            }
        }
예제 #4
0
        public static void StopListening(string eventName, UnityAction <object, object> listener)
        {
            if (eventManager == null)
            {
                return;                       // In case we've already destroyed our eventManager, avoid exceptions.
            }
            UnityTwoArgsEvent thisEvent = null;

            if (instance.eventTwoArgsDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.RemoveListener(listener);
            }
        }
        public static void StartListening(string eventName, UnityAction <object, object> listener)
        {
            UnityTwoArgsEvent thisEvent = null;

            if (instance.eventTwoArgsDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.AddListener(listener);
            }
            else
            {
                thisEvent = new UnityTwoArgsEvent();
                thisEvent.AddListener(listener);
                instance.eventTwoArgsDictionary.Add(eventName, thisEvent);
            }
        }