public static void TriggerEvent(string eventName, Hashtable hashtable)
    {
        HashtableEvent unityEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out unityEvent))
        {
            unityEvent.Invoke(hashtable);
        }
    }
Example #2
0
        /// <summary>
        /// call to trigger the event
        /// </summary>
        public static void TriggerEvent(string eventName, Hashtable eventParams = default(Hashtable))
        {
            HashtableEvent thisEvent = null;

            if (Instance.EventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.Invoke(eventParams);
            }
        }
    public static void StopListening(string eventName, UnityAction <Hashtable> listener)
    {
        if (eventManager == null)
        {
            return;
        }
        HashtableEvent unityEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out unityEvent))
        {
            unityEvent.RemoveListener(listener);
        }
    }
Example #4
0
        /// <summary>
        /// unregister a listener from the event manager
        /// </summary>
        public static void StopListening(string eventName, UnityAction <Hashtable> listener)
        {
            if (Instance == null)
            {
                return;
            }

            HashtableEvent thisEvent = null;

            if (Instance.EventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.RemoveListener(listener);
            }
        }
Example #5
0
        /// <summary>
        /// register a listener to the event manager
        /// </summary>
        public static void StartListening(string eventName, UnityAction <Hashtable> listener)
        {
            HashtableEvent thisEvent = null;

            if (Instance.EventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.AddListener(listener);
            }
            else
            {
                thisEvent = new HashtableEvent();
                thisEvent.AddListener(listener);
                Instance.EventDictionary.Add(eventName, thisEvent);
            }
        }
    public static void StartListening(string eventName, UnityAction <Hashtable> listener)
    {
        HashtableEvent unityEvent = null;

        if (instance.eventDictionary.TryGetValue(eventName, out unityEvent))
        {
            unityEvent.AddListener(listener);
        }
        else
        {
            unityEvent = new HashtableEvent();
            unityEvent.AddListener(listener);
            instance.eventDictionary.Add(eventName, unityEvent);
        }
    }
Example #7
0
        public void StopListening(string eventName, UnityAction <Hashtable> listener)
        {
            HashtableEvent thisEvent = null;

            if (eventDictionary.TryGetValue(eventName, out thisEvent))
            {
                if (listener == null)
                {
                    thisEvent.RemoveAllListeners();
                }
                else
                {
                    thisEvent.RemoveListener(listener);
                }
            }
        }